The Maze Explorer

Time Limit: 1 Second    Memory Limit: 32768 KB

Sunny Cup 2003 - Preliminary Round

April 20th, 12:00 - 17:00

Problem I: The Maze Explorer


There is a huge labyrinth near the house so little Dennis always enjoys walking his doggie, The Maze Explorer, around. The labyrinth is built with several sections. Each section is painted a different color. The sections are of the same height so you can't see the things behind. Dennis is wondering how many sections there are in the labyrinth, and that's exactly what The Maze Explorer is good at. He would move around reaching every possible position in the labyrinth reporting the result to his master. Now you are to simulate his logic.

The sections are simple polygons of the same height. To make life easier, Dennis would propose only orthogonal polygons for this problem, that is, each edge of the polygons is parallel to either the x-axis or the y-axis. Being simple, means no two edges intersect except the neighboring ones. Colors are denoted with lower-case letters.

Here is an example. There are two sections and The Maze Explorer sees both of them.

Here is another example. There are three sections. The designer of the labyrinth conceals one in the center on purpose and The Maze Explorer can't see it. Notice even if there is room inside, he can't walk in since there is no path from outside.

Input

There are multiple tests. Each test initiates with a line with one integer m (0 < m <= 26), the number of sections in the maze. A case with m = 0 terminates the input.

The following m lines contain data for each section. Each line starts with an integer Ni (4 <= Ni <= 50), the number of vertices of the polygon. Since it's orthogonal, you shall also expect this number to be even. The following 2Ni integers are the ordered coordinates of the polygon, in the form X1 Y1 X2 Y2 ... XNi YNi. The color of the sections are counted from a, in the order they appear in the input. The sample input corresponds to the two examples.

Output

One line for each test, prints all the colors The Maze Explorer has found. The colors are to be printed with no space embedded, in alphabetical order.

Sample Input

2
4 0 0 0 1 1 1 1 0
4 1 2 1 3 2 3 2 2
3
6 0 1 0 5 4 5 4 4 1 4 1 1
4 1 1 1 3 3 3 3 1
6 1 0 1 1 4 1 4 5 5 5 5 0
0

Sample Output

ab
ac
Submit

Source: Zhejiang University Local Contest 2003, Preliminary