gap> r := rec(); for i in [1..10000] do r := rec(a := r); od;
rec(  )
gap> Print(r);
rec(
  a := rec(
      a := rec(
          a := rec(
              a := rec(
                  a := rec(
                      a := rec(
                          a := rec(
                              a := rec(
                                  a := rec(
                                      a := rec(
                                          a := rec(
                                              a := rec(
                                                  a := rec(
                                                      a := rec(
                                                          a := rec(
                                                              a := rec(
                                                                  a := rec(
                                                                      a := rec(
                                                                          a := rec(
                                                                              a := rec(
                                                                                  a := rec(
                                                                                      a := rec(
                                                                                          a := rec(
                                                                                              a := rec(
                                                                                                  a := rec(
                                                                                                      a := rec(
                                                                                                          a := rec(
                                                                                                              a := rec(
                                                                                                                  a := rec(
                                                                                                                      a := rec(
                                                                                                                          a := rec(
                                                                                                                              a := rec(
                                                                                                                                  a := rec(
                                                                                                                                      a := rec(
                                                                                                                                          a := rec(
                                                                                                                                              a := rec(
                                                                                                                                                  a := rec(
                                                                                                                                                      a := rec(
                                                                                                                                                          a := rec(
                                                                                                                                                              a := rec(
                                                                                                                                                                  a := rec(
                                                                                                                                                                      a := rec(
                                                                                                                                                                          a := rec(
                                                                                                                                                                              a := rec(
                                                                                                                                                                                  a := rec(
                                                                                                                                                                                      a := rec(
                                                                                                                                                                                          a := rec(
                                                                                                                                                                                              a := rec(
                                                                                                                                                                                                  a := rec(
                                                                                                                                                                                                      a := rec(
                                                                                                                                                                                                          a := rec(
                                                                                                                                                                                                              a := rec(
                                                                                                                                                                                                                  a := rec(
                                                                                                                                                                                                                      a := rec(
                                                                                                                                                                                                                          a := rec(
                                                                                                                                                                                                                              a := rec(
                                                                                                                                                                                                                                  a := rec(
                                                                                                                                                                                                                                      a := rec(
                                                                                                                                                                                                                                          a := rec(
                                                                                                                                                                                                                                              a := rec(
                                                                                                                                                                                                                                                  a := rec(
                                                                                                                                                                                                                                                      a := rec(
                                                                                                                                                                                                                                                          a := rec(
                                                                                                                                                                                                                                                              a := 
                                                                                                                                                                                                                                                                printing stopped, too many recursion levels!
                                                                                                                                                                                                                                                                 ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )
gap> String(r);
Error, recursion depth trap (5000)
Stack trace:
*[1] String( record.(nam) )
   @ GAPROOT/lib/record.gi:LINE
 [2] String( record.(nam) )
   @ GAPROOT/lib/record.gi:LINE
 [3] String( record.(nam) )
   @ GAPROOT/lib/record.gi:LINE
 [4] String( record.(nam) )
   @ GAPROOT/lib/record.gi:LINE
 [5] String( record.(nam) )
   @ GAPROOT/lib/record.gi:LINE
...  at *stdin*:4
you may 'return;'
brk> return; # try once more
Error, recursion depth trap (5000)
Stack trace:
*[1] String( record.(nam) )
   @ GAPROOT/lib/record.gi:LINE
 [2] String( record.(nam) )
   @ GAPROOT/lib/record.gi:LINE
 [3] String( record.(nam) )
   @ GAPROOT/lib/record.gi:LINE
 [4] String( record.(nam) )
   @ GAPROOT/lib/record.gi:LINE
 [5] String( record.(nam) )
   @ GAPROOT/lib/record.gi:LINE
...  at *stdin*:4
you may 'return;'
brk> QUIT;
