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

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

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

c = A("c")
e = B("e")
b = C("b")
n = B("n")
d = A("d")
k = C("k")

c.x = d
c.u = e
c.q = b
e.s = n
b.v = d
b.z = e
n.s = e
d.x = c
d.u = e
d.q = k
k.v = c
k.z = n
assert n.s.s.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: B = None
        self.q: C = None
        self.txt = txt

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

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

c = A("c")
e = B("e")
b = C("b")
n = B("n")
d = A("d")
k = C("k")

c.x = d
c.u = e
c.q = b
e.s = n
b.v = d
b.z = e
n.s = e
d.x = c
d.u = e
d.q = k
k.v = c
k.z = n
assert n.s.s.s.s.s.s.txt == "n"