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

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

f = A("f")
i = B("i")
g = A("g")
c = B("c")
l = A("l")
k = A("k")
m = A("m")
e = B("e")

f.t = c
f.r = k
i.o = e
g.t = c
g.r = k
c.o = i
l.t = e
l.r = k
k.t = i
k.r = l
m.t = i
m.r = k
e.o = i
assert c.o.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: A = None
        self.txt = txt

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

f = A("f")
i = B("i")
g = A("g")
c = B("c")
l = A("l")
k = A("k")
m = A("m")
e = B("e")

f.t = c
f.r = k
i.o = e
g.t = c
g.r = k
c.o = i
l.t = e
l.r = k
k.t = i
k.r = l
m.t = i
m.r = k
e.o = i
assert c.o.o.o.o.o.o.txt == "e"