#K61927. Airport Conflict Detection

    ID: 31418 Type: Default 1000ms 256MiB

Airport Conflict Detection

Airport Conflict Detection

You are given two schedules: one for plane landings and one for departures at an airport. Each schedule consists of records in the format: PlaneID StartTime EndTime.

A conflict between a landing and a departure is defined by overlapping time intervals. In particular, two intervals \([a, b]\) and \([c, d]\) overlap if and only if \(a \le d\) and \(b \ge c\). If a conflict exists between a landing record and a departure record, output the message Conflict detected: (LandingPlane, DeparturePlane), where LandingPlane and DeparturePlane are the identifiers of the first conflicting pair encountered in the input order. Otherwise, output No conflicts.

Note that even if two intervals touch at an endpoint (for example, one ends exactly when another begins), this is considered a conflict.

inputFormat

The first line of the input contains two space-separated integers \(N\) and \(M\) representing the number of landing and departure records, respectively.

The next \(N\) lines each contain a landing record in the format: PlaneID StartTime EndTime.

The following \(M\) lines each contain a departure record in the same format.

All times are integer values.

outputFormat

Output a single line representing the result. If a conflict is detected, output the message Conflict detected: (LandingPlane, DeparturePlane) with the appropriate plane identifiers. Otherwise, output No conflicts.

## sample
2 2
PlaneA 1 3
PlaneB 4 6
PlaneC 7 9
PlaneD 10 12
No conflicts