Foreign Football
문제
You are on vacation in a foreign country. This country has a local football league, and you don't know any of the team names. However, you have found a table of all the results from this season, and next to every match is the concatenated names of the two teams that played.
There are teams in total, named . You are given the concatenation for every ordered pair . Find the teams names . Team names must be nonempty, but they do not need to be distinct.
입력
The first line of input contains the integer ().
The following lines each contain strings, the table of concatenated team names. The :th string on the :th of these lines will contain the string if , and "*" if . The concatenated team names will consist of lower case characters a-z.
The total number of characters in concatenated team names is at most .
출력
If there is no solution, print "NONE".
If there is more than one solution, print "MANY".
If there is one unique solution, print "UNIQUE", followed by lines containing .
예제
예제 1
3 * difaik difhammarby aikdif * aikhammarby hammarbydif hammarbyaik *
UNIQUE dif aik hammarby
예제 2
2 * aaaa aaaa *
MANY
예제 3
3 * a ab a * b ba b *
NONE
예제 4
2 * zz zz *
UNIQUE z z