class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.q: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: E = None
        self.s: C = None
        self.z: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.s: C = None
        self.txt = txt

c = A("c")
n = B("n")
k = C("k")
f = D("f")
g = E("g")

c.v = g
c.q = g
n.p = f
n.u = k
k.z = c
f.u = n
f.t = g
f.s = k
f.z = k
g.r = k
g.s = k
assert n.p.t.s.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.q: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: E = None
        self.s: C = None
        self.z: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.s: C = None
        self.txt = txt

c = A("c")
n = B("n")
k = C("k")
f = D("f")
g = E("g")

c.v = g
c.q = g
n.p = f
n.u = k
k.z = c
f.u = n
f.t = g
f.s = k
f.z = k
g.r = k
g.s = k
assert n.p.t.s.z.v.txt == "g"