{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"\u003cp\u003eTeddy and Tracy like to play a game based on strings. The game is as follows. Initially, Tracy writes a long random string on a whiteboard. Then, each player starting with Teddy makes turn alternately. Each turn, the player must erase a contiguous substring that exists in the dictionary. The dictionary consists of \u003ci\u003eN\u003c/i\u003e words.\u003c/p\u003e\n\n\u003cp\u003eOf course, the player that can\u0027t erase any substring in his turn loses the game, and the other player is declared the winner.\u003c/p\u003e\n\n\u003cp\u003eNote that after a substring R is erased, the remaining substring becomes separated, i.e. they cannot erase a word that occurs partially to the left of R and partially to the right of R.\n\n\u003c/p\u003e\u003cp\u003eDetermine the winner of the game, assuming that both players play optimally.\u003c/p\u003e\n\n\u003ch3\u003eInput\u003c/h3\u003e\n\u003cp\u003eThe first line contains a single integer \u003ci\u003eT\u003c/i\u003e, the number of test cases. \u003ci\u003eT\u003c/i\u003e test cases follow. The first line of each testcase contains a string \u003ci\u003eS\u003c/i\u003e, the string Tracy writes on the whiteboard. The next line contains a single integer \u003ci\u003eN\u003c/i\u003e. \u003ci\u003eN\u003c/i\u003e lines follow. The \u003ci\u003ei\u003c/i\u003e-th line contains a single string \u003ci\u003ew\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e, the \u003ci\u003ei\u003c/i\u003e-th word in the dictionary.\u003c/p\u003e\n\n\u003ch3\u003eOutput\u003c/h3\u003e\n\u003cp\u003eFor each test case, output a single line containing the name of the winner of the game.\u003c/p\u003e\n\n\u003ch3\u003eConstraints\u003c/h3\u003e\n\u003cul\u003e\u003cli\u003e1 \u003c\u003d \u003ci\u003eT\u003c/i\u003e \u003c\u003d 5\u003c/li\u003e\n\u003cli\u003e1 \u003c\u003d \u003ci\u003eN\u003c/i\u003e \u003c\u003d 30\u003c/li\u003e\n\u003cli\u003e1 \u003c\u003d |\u003ci\u003eS\u003c/i\u003e| \u003c\u003d 30\u003c/li\u003e\n\u003cli\u003e1 \u003c\u003d |\u003ci\u003ew\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e| \u003c\u003d 30\u003c/li\u003e\n\u003cli\u003e\u003ci\u003eS\u003c/i\u003e and \u003ci\u003ew\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e contain only characters \u0027a\u0027-\u0027z\u0027\u003c/li\u003e\n\u003c/ul\u003e"}},{"title":"Sample 1","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\ncodechef\n2\ncode\nchef\nfoo\n1\nbar\nmississippi\n4\nssissi\nmippi\nmi\nppi\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eTracy\nTracy\nTeddy\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}