Krypton Stadiums
Time limit10sMemory limit512 MB
Given n intervals where interval i contains point i, classify the layout as Great, Acceptable, or Bad based on whether pairs of cities are co-hosted by a nesting or shared stadium.
Problem
The planet Krypton has cities. They sit at distinct points on one straight line running west to east, and they are labelled from west to east. Each city has one team and one stadium.
Stadium carries two integers and . The team from city plays at stadium only when . Every team can play at its home stadium, so is guaranteed.
Before the season schedule is written, the layout of the cities and stadiums gets one of three verdicts.
- The layout is
Greatif for every pair of cities and some stadium with can host the teams from both cities. - The layout is
Acceptableif it is notGreatbut for every pair of cities and some stadium can host the teams from both cities. - The layout is
Badif there is a pair of cities that no stadium can host together.
Input
The input holds several test cases and ends at end of file.
The first line of each test case has the number of cities (). The next lines give the intervals of stadiums through in order. Each line has exactly six characters: the first three give and the last three give . Each group of three characters is a three digit base 62 number that uses 0-9A-Za-z as the digits with values through . For example, cities , , , , , , , and are written 000, 001, 009, 00A, 00Z, 00a, 00z, 010 and q1n. Always .
There are at most test cases and at most stadiums over all test cases.
Output
For each test case print one of Great, Acceptable or Bad on its own line.