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

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

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

c = A("c")
a = B("a")
n = C("n")
h = C("h")
m = C("m")

c.w = a
c.x = a
c.t = h
a.u = h
n.o = h
n.z = c
n.u = a
h.o = n
h.z = c
h.u = a
m.o = n
m.z = c
m.u = a
assert h.o.z.t.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.x: B = None
        self.t: C = None
        self.txt = txt

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

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

c = A("c")
a = B("a")
n = C("n")
h = C("h")
m = C("m")

c.w = a
c.x = a
c.t = h
a.u = h
n.o = h
n.z = c
n.u = a
h.o = n
h.z = c
h.u = a
m.o = n
m.z = c
m.u = a
assert h.o.z.t.u.u.txt == "h"