Intersection of objects with priorities
Task «Intersection of objects with priorities»
Input Format
In the first line, an integer N — the number of objects in the first set. Then N lines, each containing an identifier (integer), type (string without spaces), and priority (integer) separated by spaces. In the next line, an integer M — the number of objects in the second set. Then M lines in the same format.
Output Format
For each intersecting object, output one line: identifier, type, minimum priority separated by spaces. The lines are sorted by identifier in ascending order, and in case of equality, by type lexicographically. If there are no intersections, output 'none'.