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

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

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

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

b.u = d
b.z = e
d.w = m
d.t = m
c.u = h
c.r = e
c.y = b
h.u = c
h.r = j
h.y = j
e.u = d
e.z = b
n.u = h
n.r = j
n.y = b
j.u = m
j.z = b
m.w = d
m.t = d
assert h.y.u.w.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: A = None
        self.txt = txt

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

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

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

b.u = d
b.z = e
d.w = m
d.t = m
c.u = h
c.r = e
c.y = b
h.u = c
h.r = j
h.y = j
e.u = d
e.z = b
n.u = h
n.r = j
n.y = b
j.u = m
j.z = b
m.w = d
m.t = d
assert h.y.u.w.t.t.t.txt == "m"