#T72. 烦人的幻灯片

烦人的幻灯片

Description

Professor Li will deliver a very important speech this afternoon. Unfortunately, he is not a very tidy person and has haphazardly stacked the slides he needs for the presentation. Therefore, he has to sort them out before the speech. As an efficiency-minded scholar, he hopes to accomplish this as simply as possible. The professor will use a total of n slides (n ≤ 26) for this speech, and these n slides have already been numbered from 1 to n in the order they are to be used. Since the slides are transparent, we cannot immediately discern which number corresponds to which slide.

Now, we renumber the slides sequentially using uppercase letters A, B, C, etc. Your task is to write a program that matches the numeric labels of the slides with their alphabetic labels. Clearly, this correspondence should be unique; if multiple correspondences are possible or if certain numeric labels cannot be matched to alphabetic labels, we consider the correspondence impossible to achieve.

Input Format

The first line contains a single integer n, indicating the number of slides. The next n lines each contain four integers xmin, xmax, ymin, ymax (separated by spaces), representing the coordinates of the slides. These n slides are sequentially labeled from front to back as A, B, C, etc., in the order they appear in the file. The following n lines provide the coordinates x, y of the numeric labels, and it is guaranteed that no numeric label will appear outside any slide.

Output Format

If the correspondence can be achieved, the output file should consist of n lines, each containing a letter and a number separated by a space, with the lines sorted in ascending order of the letters. Note that the letters should be uppercase and left-aligned. If the correspondence cannot be achieved, the first line of the file should simply output "None" left-aligned, with no trailing spaces at the end of the line.

4
6 22 10 20
4 18 6 16
8 20 2 18
10 24 4 8
9 15
19 17
11 7
21 11

A 4
B 1
C 2
D 3