program IlFincom;
   uses crt;
   type mi6ma6 =array[1..100] of string;
   var N,Max,Min,i:integer;
       minl:longint;
       x,y:mi6ma6;
       j,tr,br,yi,jj:integer;
       Ss:string;
   procedure create(var x:mi6ma6;N:integer);
      var i:integer;
      begin
        for i:=1 to N do
                      readln(x[i]);
      end;

   BEGIN

      clrscr;
      repeat
          readln(N);
        until (n>=2) and(n<=20);

   Create(x,N);

      Max:=0;
      Minl:=50000;
      min:=25000;
      for i:=1 to N do
               if minl>length(x[i]) then minl:=length(x[i]);
      max:=minl div 2;
      min:=minl div 10;
      yi:=0;
      for tr:= min to max do
               for jj:= 1 to length(x[1]) do begin
                             ss:=copy(x[1],jj,tr);
                             br:=1;
                             for i:= 2 to n do
                                 for j:= 1 to length(x[i]) do
                                         if ss= copy(x[i],j,tr) then begin
                                                                br:=br+1;
                                                                j:=length(x[i]);
                                                                end;
                             if br=n then begin
                                          yi:=yi+1;
                                          y[yi]:=ss ;
                                          end;
      end;
      {Tui kato tr se izmenia vuv vuzhodiasht red logichno e che posledniat nameren string shte e nai- dulug}
      write(y[yi]:5);
       readln;
    end.