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

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

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

a = A("a")
c = B("c")
g = C("g")
j = B("j")
n = A("n")

a.v = n
a.w = g
a.z = g
c.u = j
g.q = n
g.s = j
g.y = a
j.u = c
n.v = a
n.w = g
n.z = g
assert g.y.z.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.w: C = None
        self.z: C = None
        self.txt = txt

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

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

a = A("a")
c = B("c")
g = C("g")
j = B("j")
n = A("n")

a.v = n
a.w = g
a.z = g
c.u = j
g.q = n
g.s = j
g.y = a
j.u = c
n.v = a
n.w = g
n.z = g
assert g.y.z.s.u.txt == "c"