class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.t: A = None
        self.txt = txt

e = A("e")
l = B("l")
b = B("b")
k = B("k")
f = B("f")

e.r = l
l.v = e
l.t = e
b.v = e
b.t = e
k.v = e
k.t = e
f.v = e
f.t = e
assert b.v.r.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.t: A = None
        self.txt = txt

e = A("e")
l = B("l")
b = B("b")
k = B("k")
f = B("f")

e.r = l
l.v = e
l.t = e
b.v = e
b.t = e
k.v = e
k.t = e
f.v = e
f.t = e
assert b.v.r.v.r.txt == "l"