integer;
left, right : ptree;
end;
function addEl(l,r : ptree; el : integer) : ptree;
var
pl : ptree;
begin
New(pl);
pl^.el := el;
pl^.left := l;
pl^.right := r;
addEl := pl;
end;
function copyTree(t : ptree) : ptree;
var
pt : ptree;
begin
if t = nil then copyTree := nil
else begin
New(pt);
pt^.el := t^.el;
pt^.left := copyTree(t^.left);
pt^.right := copyTree(t^.right);
copyTree := pt;
end;
end;
prevt := nil; t := addEl(nil,nil,i);
for i := 1 to 6 do begin
r := copyTree(prevt);
prevt := t;
t := addEl(t,r,i);
end;