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

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

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

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

a = A("a")
n = B("n")
d = C("d")
h = D("h")
k = C("k")
c = A("c")

a.t = n
a.s = n
n.v = c
d.q = a
d.p = a
d.u = c
d.s = c
h.z = c
k.q = c
k.u = c
k.p = c
k.s = c
c.t = n
c.s = n
assert d.q.s.v.s.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: B = None
        self.txt = txt

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

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

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

a = A("a")
n = B("n")
d = C("d")
h = D("h")
k = C("k")
c = A("c")

a.t = n
a.s = n
n.v = c
d.q = a
d.p = a
d.u = c
d.s = c
h.z = c
k.q = c
k.u = c
k.p = c
k.s = c
c.t = n
c.s = n
assert d.q.s.v.s.v.s.txt == "n"