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

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

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

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

k = A("k")
c = B("c")
n = C("n")
d = D("d")
i = A("i")
a = C("a")
l = D("l")
f = D("f")
b = B("b")

k.s = f
c.z = a
c.p = d
c.v = f
n.z = i
n.q = f
d.s = a
i.s = d
a.z = k
a.q = d
l.s = a
f.s = n
b.z = a
b.p = f
b.v = f
assert n.z.s.s.z.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

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

k = A("k")
c = B("c")
n = C("n")
d = D("d")
i = A("i")
a = C("a")
l = D("l")
f = D("f")
b = B("b")

k.s = f
c.z = a
c.p = d
c.v = f
n.z = i
n.q = f
d.s = a
i.s = d
a.z = k
a.q = d
l.s = a
f.s = n
b.z = a
b.p = f
b.v = f
assert n.z.s.s.z.s.s.txt == "n"