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

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

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

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

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

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

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