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

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

e = A("e")
n = B("n")
m = A("m")
b = A("b")
d = B("d")
h = B("h")
f = A("f")
i = A("i")
j = B("j")
l = B("l")

e.o = b
n.t = d
m.o = f
b.o = i
d.t = n
h.t = j
f.o = i
i.o = b
j.t = l
l.t = j
assert i.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

e = A("e")
n = B("n")
m = A("m")
b = A("b")
d = B("d")
h = B("h")
f = A("f")
i = A("i")
j = B("j")
l = B("l")

e.o = b
n.t = d
m.o = f
b.o = i
d.t = n
h.t = j
f.o = i
i.o = b
j.t = l
l.t = j
assert i.o.o.o.o.txt == "i"