The secret server of ICPC (Inter-Continental Programming Company) uses two passwords v and w. The two strings satisfy v∣w∣=w∣v∣, which means that v concatenated ∣w∣ times and w concatenated ∣v∣ times give the same string, where ∣v∣ is the length of the string v. For example, with v=ab and w=abab you get v4=w2=abababab. The trivial case v=w is not secure, so it is never used.
The two strings are hard to memorize, so the administrator hid them in a set of n strings. The set contains two distinct strings x and y such that v is a prefix of x (x=vv′) and w is a suffix of y (y=w′w).
Given the set of strings, write a program that finds the password pair.
Your program reads from standard input. The first line contains the number of test cases T.
Each test case begins with a line containing n, the number of strings in the set. (2≤n≤200)
Each of the next n lines contains one string. Every string consists of lowercase English letters and its length is at most 20,000.
Your program writes to standard output. Print exactly one line for each test case.
Each line contains two integers ∣v∣ and ∣w∣, where two distinct strings x and y of the set satisfy that v is a prefix of x, w is a suffix of y, v∣w∣=w∣v∣ and ∣v∣<∣w∣. If two or more such pairs exist, print the one whose ∣v∣+∣w∣ is the greatest. Such a password pair is unique whenever it exists. If there is no such pair, print 0 0.