It's hard for Hong to find the longest common substring of N different strings. Hong wants you to solve this question.
11501150
It's hard for Hong to find the longest common substring of N different strings. Hong wants you to solve this question.
The first line will be an integer T (1≤T≤10), which is the number of test cases.
For each test data:
The first line contains an integer N (1≤N≤1000) — the number of the sentences.
Each of the next N lines contains a string s, which consists of lowercase letters (no space) only. The length of each string will be at least 1 and at most 200 characters.
For each case please print the lexicographically smallest longest common substring. If there is no such non-empty string, output the words “Hong” instead.
1
3
aabbaabb
abbababb
bbbbbabb
abb