program kkkk;
uses crt;
const nmax=100;
type men=record
surname:string;married:boolean;
stage:byte;
end;
list=array[1..nmax] of men;
var a:list; f:text;
n:byte; s:string;i,min,imin:integer;
{procedure init(var x:list;var k:byte);
var f:text;s:string;
begin
assign(f,'c:\test.txt');
reset(f);
k:=0;
while not eof(f) do begin
inc(k);
with x[k] do begin
readln(f,surname);
readln(f,s);
if s='da' then married:=true;
readln(f,stage);
end;end;
close(f);
end;
procedure solve (var x:list;k:byte);
var i,min,imin:byte;
f:text;
BEGIN
clrscr;
assign(f,'c:\output.txt');
rewrite(f);
min:=100;
for i:=1 to k do
with x[i] do
if not married and (stage begin min:=stage;imin:=i;end;
writeln(f,'xolostou rabotnik c min ctagem:',x[imin].surname);
close(f);
end;}
begin

clrscr;
assign(f,'c:\test.txt');
reset(f);
n:=0;
while not eof(f) do begin
n:=n+1;
with a[n] do begin
readln(f,surname);
readln(f,s);
if s='da' then married:=true;
readln(f,stage);
end;end;
close(f);
for i:=1 to n do
writeln(a[i].surname,' ',a[i].married,' ',a[i].stage);
assign(f,'c:\output.txt');
rewrite(f);
min:=100;
for i:=1 to n do
with a[i] do
if (married=false) and (stage begin min:=stage;imin:=i;writeln(imin);end;
writeln(f,'xolostou rabotnik c min ctagem:',a[imin].surname);
close(f);
readln;
END.