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

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

g = A("g")
j = B("j")
l = B("l")
b = B("b")
f = A("f")
a = B("a")
e = B("e")
n = B("n")

g.t = b
g.u = l
j.y = n
l.y = a
b.y = n
f.t = e
f.u = e
a.y = j
e.y = n
n.y = j
assert a.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: B = None
        self.txt = txt

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

g = A("g")
j = B("j")
l = B("l")
b = B("b")
f = A("f")
a = B("a")
e = B("e")
n = B("n")

g.t = b
g.u = l
j.y = n
l.y = a
b.y = n
f.t = e
f.u = e
a.y = j
e.y = n
n.y = j
assert a.y.y.y.txt == "j"