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

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

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

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

d = A("d")
b = B("b")
j = C("j")
k = D("k")
g = C("g")
n = D("n")
e = B("e")

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

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

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

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

d = A("d")
b = B("b")
j = C("j")
k = D("k")
g = C("g")
n = D("n")
e = B("e")

d.v = b
d.s = b
d.p = j
d.t = j
b.s = j
j.z = k
j.q = b
j.u = b
j.p = b
k.z = d
g.z = k
g.q = b
g.u = b
g.p = b
n.z = d
e.s = j
assert d.p.z.z.v.s.z.txt == "k"