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

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

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

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

c.z = h
m.s = f
m.o = a
m.u = a
h.q = m
f.q = a
g.q = a
n.q = a
a.s = h
a.o = m
a.u = m
assert a.s.q.o.u.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

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

c.z = h
m.s = f
m.o = a
m.u = a
h.q = m
f.q = a
g.q = a
n.q = a
a.s = h
a.o = m
a.u = m
assert a.s.q.o.u.s.q.txt == "a"