#0000CB

mit-virus

A new computer virus infects programs by overwriting part of their code with its own. It is known that the virus does not mutate and always infects the victims exactly once, but possibly at different positions in the victim's code.


You are given the code of several programs that are known to be infected with the virus. Your task is to find the code of the virus. Among all possible candidates for viruses, the real one has the largest length. Furthermore, there is only one ``candidate'' that has the largest length, the real virus.


InputData is read from the standard input. The first line of the input contains one integer: the number of test cases that follow.

For each test case the first line contains exactly one integer: the number k (k <= 20) of infected programs you are presented with. The next k lines contain the code of the infected programs, one per line. The code is composed of capital hexadecimal digits with no whitespaces. All infected programs have length that does not exceed 50,000 characters. Moreover, for each case the actual length of the virus is between 0.05 and 0.5 times the length of the longest infected program given for that test.

Note that there are no empty lines in the input file.

OutputOutput is written to the standard output.

There should be one line of hexadecimal symbols per test case: the code of the virus.

No empty lines between the test cases are allowed.

Input:
1
3
010101DEADBEEF01
DEADDEADBEEFBEEF
DEADBEEF12345678

Output:
DEADBEEF

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.