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

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

n = A("n")
m = B("m")
l = A("l")
c = B("c")
d = B("d")
e = B("e")
b = B("b")
h = B("h")

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

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

n = A("n")
m = B("m")
l = A("l")
c = B("c")
d = B("d")
e = B("e")
b = B("b")
h = B("h")

n.u = l
m.t = n
l.u = n
c.t = l
d.t = n
e.t = l
b.t = l
h.t = l
assert d.t.u.u.u.u.txt == "n"