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

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

h = A("h")
l = B("l")
b = A("b")
n = B("n")
m = B("m")
i = A("i")

h.t = n
l.z = n
b.t = n
n.z = m
m.z = l
i.t = n
assert n.z.z.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

h = A("h")
l = B("l")
b = A("b")
n = B("n")
m = B("m")
i = A("i")

h.t = n
l.z = n
b.t = n
n.z = m
m.z = l
i.t = n
assert n.z.z.z.z.z.z.txt == "n"