import java.util.*;

public class identity {

 public static void main(String[] args){
  Scanner sc = new Scanner(System.in);

  while (sc.hasNextLine()){
   int count = sc.nextInt();

   if (count != 0){
    sc.nextLine();

    String pole[] = new String[count];
    int pocet = 0;
    int found = 0;

    for (int i = 0; i < count; i++){
     pole[i] = sc.nextLine();
     pocet++;
    }

    int delka = pole[0].length();

     for (int o = 0; o < delka; o++){
      int start = o;

      for (int x = start; x < delka; x++){
       String row_out = "";

       for (int z = start; z < (delka - x + o); z++){
        row_out = row_out.concat(Character.toString(pole[0].charAt(z)));
       }

       int shoda = 0;

       for (int a = 0; a < pocet; a++){
        if (pole[a].matches("^*" + row_out + "*$")){
         shoda++;
        }
       }
       
       if (shoda == pocet){
        found = 1;

        System.out.println(row_out);
       }
      }
     }

    if (found == 0){
     System.out.println("IDENTITY LOST");
    }
   }
  }
 }
}