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

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

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

c = A("c")
a = B("a")
l = C("l")
k = C("k")
n = B("n")
g = C("g")

c.z = k
c.q = n
a.q = l
a.u = c
a.t = c
l.w = n
l.v = c
k.w = n
k.v = c
n.q = k
n.u = c
n.t = c
g.w = n
g.v = c
assert a.q.w.u.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: B = None
        self.txt = txt

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

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

c = A("c")
a = B("a")
l = C("l")
k = C("k")
n = B("n")
g = C("g")

c.z = k
c.q = n
a.q = l
a.u = c
a.t = c
l.w = n
l.v = c
k.w = n
k.v = c
n.q = k
n.u = c
n.t = c
g.w = n
g.v = c
assert a.q.w.u.q.u.txt == "c"