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

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.w: C = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.w: C = None
        self.txt = txt

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

m.t = i
m.u = i
l.u = m
l.r = n
h.q = i
h.w = b
i.t = m
i.u = m
e.q = m
e.w = h
b.q = i
b.w = h
n.u = m
n.r = l
assert m.u.u.t.txt == "i"