Answer:
Explanation:
 p := FIRST(L);
 while p <> END(L) do begin
   q := p;
   while q <> END(L) do begin
     q := NEXT(q, L);
     r := FIRST(L);
     while r <> q do
       r := NEXT(r, L)
   end;
   p := NEXT(p, L)
 end;