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

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

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

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

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

k.s = n
k.u = d
k.z = a
l.z = k
l.p = n
e.s = a
e.x = l
e.y = i
e.r = k
d.r = c
d.v = n
d.z = k
d.x = l
n.z = k
n.p = l
a.s = e
a.y = e
a.x = l
a.r = k
c.r = d
c.v = l
c.z = k
c.x = n
i.s = a
i.x = n
i.y = e
i.r = k
assert d.x.z.u.v.z.z.s.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.u: D = None
        self.z: C = None
        self.txt = txt

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

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

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

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

k.s = n
k.u = d
k.z = a
l.z = k
l.p = n
e.s = a
e.x = l
e.y = i
e.r = k
d.r = c
d.v = n
d.z = k
d.x = l
n.z = k
n.p = l
a.s = e
a.y = e
a.x = l
a.r = k
c.r = d
c.v = l
c.z = k
c.x = n
i.s = a
i.x = n
i.y = e
i.r = k
assert d.x.z.u.v.z.z.s.x.txt == "l"