type

 ubslink = ^ubsnode;

 ubsnode = record        { node in the tree }
   element: char;
   left,
   right: ubslink;       { left end right subtree }
 end;

 ubs = ubslink;          { set type }

 ubselement = char;

function compare(e1,e2 : ubselement):integer;
{+--- on entry - e1 and e2 are transfered in for a comparison
|    on exit  - compare returns +1 iff e1 > e2
|                                0 iff e1 = e2
|                               -1 iff e1 < e2
+----------------------------------------------------------------------}

begin {compare}
if e1 > e2 then compare := 1
          else if e1 < e2 then compare := -1
                          else compare := 0;
end; {compare}


procedure print(var out:text; e:ubselement);
{+--- on entry - e is contained in the list and is ready for output
|    on exit  - e has been written to the corresponding out file
+------------------------------------------------------------------------}

begin {print}
writeln (out,e:4);
end; {print}