

Both names are identical.
name1 is a prefix of name2.
name2 is a prefix of name1.
The first line contains 'T', denoting the number of tests.
For each Test :
The first line contains one integer 'N', denoting the number of names in the list.
Next 'N' lines contain one string each, denoting the names in the list.
For each test, print one string, denoting the first name in the list, similar to another name in the prefix part of the list. If no such name is found, print “not found”.
You are not required to print the expected output. It has already been taken care of. Just implement the function.
1 <= 'T' <= 5
1 <= 'N' <= 10^5
1 <= the length of name[i] <= 60 i ∈ (1,N)
All letters in name[i] are lowercase english letters, in the range 'a' to 'j' inclusive.
Note - Sum of 'N' over all test cases does not exceed 10^5.
Time Limit: 1 sec
Algorithm:
The nodes in our trie will contain the following two informations:-
We insert the names in the trie, in the same order we are getting in input data. When i-th name is inserted, trie will already have all names to which i-th name will be compared to become an answer, i.e., all names in the prefix part of the list are already inserted in the trie. While inserting i-th name in trie, if a similarity is found, i-th name becomes our answer, and there is no need to proceed with the remaining names.
How to check similarity while inserting a name in trie?
If all names are successfully inserted in trie, return "not found".
Algorithm: