uses crt;
var f:text;
    proba,virus:string;
    ogr,o,num,po:integer;
procedure enter(var f:text; var o:integer);
var i:integer;
    b:string;
begin
rewrite(f);
write('');readln(o);
writeln(f,o);
for i:=1 to o do
begin
write('');readln(b);
writeln(f,b);
end;
close(f);
end;
procedure search(var f:text;num:integer;var virus:string;o:integer;po:integer);
type masiv=array[1..20] of string;
     masiv1=array[1..20] of integer;
var a,b,c:string;
    p,i,u:integer;
    mas:masiv;
    ma:masiv1;
    bobi:boolean;
begin
reset(f);
u:=0;
writeln(f);
for i:=1 to o-1 do
begin
readln(f,a);
mas[i]:=a;
end;
close(f);
reset(f);
read(f,a);
b:=copy(a,po,num);
for i:=1 to o-1 do
begin
p:=pos(b,mas[i]);
if p<>0 then
begin
u:=u+1;
ma[u]:=p;
virus:=b;
end;
end;
bobi:=true;
for i:=1 to p do if ma[i]=0 then bobi:=false;
if bobi=true then writeln(virus);
close(f);
end;
begin
clrscr;
o:=3;
assign(f,'text.txt');
enter(f,o);
reset(f);
writeln;
read(f,proba);
ogr:=length(proba);
close(f);
for num:=3 to 10 do
for po:=1 to ogr-num do
search(f,num,virus,o,po);
readln;
append(f);
write(f,virus);
close(f);
end.


