uses crt;
type spis=^uz;
     uz=
     record
      n:integer;
      next:spis;
     end;
var a:spis;
    k:integer;

procedure vvod(a:spis);
var k:integer;
begin
repeat
 read(k);
 if k<>0 then
 begin
  new(a^.next);
  a:=a^.next;
  a^.n:=k;
  a^.next:=nil;
 end;
until k=0;
end;

function max(a,b:integer):integer;
begin
if a>b then max:=a
else max:=b;
end;

function maxspis(a:spis):integer;
begin
if a^.next<>nil then
 maxspis:=max(a^.n,maxspis(a^.next))
else
 maxspis:=a^.n;
end;

begin
clrscr;
writeln('vvedite elementi spiska (posledniy = 0):');
a:=nil;
read(k);
if k<>0 then
begin
 new(a);
 a^.n:=k;
 a^.next:=nil;
 vvod(a);
 writeln('naibolshii element = ',maxspis(a));
end
else
 writeln('net naibolshego, t.k. spisok pust');
readkey;
end.