program moj;

type 
pole=array [1..10] of string[30];
var n,m,lh,ld,i,j,k,x,p,lr:integer;
    po:pole;
    s,r:string[30];


begin

repeat  begin

readln(n);
if n<>0 then begin
for m:= 1 to n do
 begin
 readln(po[m]);
 end;
p:=0;
s:='';
ld:=length(po[1]);
lh:=0;
for k:=1 to ld do
 begin

  for j:=k to ld do
   begin
    r:=copy(po[1],j,(ld)); 
    lr:=length(r);
    x:=0;

      for i:=2 to n do
       begin
          p:=pos(r,po[i]);
          if p>0 then begin x:=x+1;        
             p:=0; end;
       end;
         if x=(n-1) then
           begin
           if lh<lr then s:=r; 
           end;
           lh:=length(s);
   end;
end;
if lh=0 then s:='IDENTITY LOST';
writeln(s);
end;
end;
until n=0;

end.

