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

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

e = A("e")
m = B("m")
d = A("d")
l = B("l")
i = A("i")
h = A("h")
j = B("j")
g = B("g")

e.t = l
e.z = j
m.y = j
d.t = g
d.z = m
l.y = g
i.t = l
i.z = j
h.t = l
h.z = g
j.y = g
g.y = j
assert j.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: B = None
        self.txt = txt

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

e = A("e")
m = B("m")
d = A("d")
l = B("l")
i = A("i")
h = A("h")
j = B("j")
g = B("g")

e.t = l
e.z = j
m.y = j
d.t = g
d.z = m
l.y = g
i.t = l
i.z = j
h.t = l
h.z = g
j.y = g
g.y = j
assert j.y.y.y.y.y.txt == "g"