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

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

i = A("i")
j = B("j")
d = A("d")
e = B("e")
k = A("k")
a = B("a")
b = A("b")
n = B("n")
h = A("h")

i.x = e
j.z = a
j.t = h
d.x = e
e.z = a
e.t = h
k.x = a
a.z = n
a.t = b
b.x = e
n.z = e
n.t = h
h.x = n
assert d.x.z.z.z.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

i = A("i")
j = B("j")
d = A("d")
e = B("e")
k = A("k")
a = B("a")
b = A("b")
n = B("n")
h = A("h")

i.x = e
j.z = a
j.t = h
d.x = e
e.z = a
e.t = h
k.x = a
a.z = n
a.t = b
b.x = e
n.z = e
n.t = h
h.x = n
assert d.x.z.z.z.t.x.txt == "n"