DWITE Contest

Test Case for Question #3 in DWITE 2012-2013 High School Round 1

Contest: DWITE 2012-2013 High School Round 1
Question: #3
Input File: DATA3.txt
Output File: OUT3.txt


Input

1
nancy alice
3
dan scooby
david scooby
troy shaggy
10
a casper
b casper
c casper
d casper
e casper
f casper
g casper
h casper
i casper
j raiden
5
jim cowboy
jane lolcat
john catdog
jack jill
jill jack
20
a a
b b
c c
d a
f f
g g
h h
w b
i c
j j
k k
l l
m m
n n
o o
t f
e l
z z
y y
x x




Output

SPOOKY
david
b c d e f g h i
SPOOKY
d w i t e