# Include <stdio. h >#include <algorithm> # include <cstring> using namespace STD; int next [100]; char Pat [100]; char a [100] [100]; int Ma; int lenp; int N; void getnext () {int I = 0, j =-1; next [0] =-1; while (I <= lenp) {If (j =-1 | Pat [J] = Pat [I]) J ++, I ++, next [I] = J; else J = next [J] ;}} void KMP () {int K, I, j, M; getnext (); MA = 100; for (k = 1; k <n; k ++) // match the remaining string {I = 0; j = 0; M = 0; while (I <60 & J <lenp) // The maximum length of each match {If (j =-1 | Pat [J] = A [k] [I]) {I ++; j ++;} else J = next [J]; If (j> m) M = J;} If (MA> m) // The minimum MA = m;} int main () {int T, I; char result [100]; char TMP [100]; scanf ("% d", & T); While (t --) {scanf ("% d", & N); for (I = 0; I <N; I ++) scanf ("% s", a [I]); int ans = 0; for (I = 0; I <= 59; I ++) {strcpy (Pat, a [0] + I); // enumerate all suffix strings of the first string, strcpy lenp = 60-i; KMP (); If (MA> ans) {ans = MA; strncpy (result, a [0] + I, ANS); // strcnpy result [ANS] = '\ 0 ';} else if (MA = ans) // The minimum output Lexicographic Order is {strncpy (TMP, a [0] + I, ANS); TMP [ANS] = '\ 0 '; if (strcmp (TMP, result) <0) strcpy (result, TMP) ;}} if (ANS> = 3) printf ("% s \ n", result ); else printf ("no significant commonalities \ n");} return 0 ;}