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

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

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

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

d = A("d")
l = B("l")
c = C("c")
k = D("k")
m = B("m")
a = D("a")

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

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

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

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

d = A("d")
l = B("l")
c = C("c")
k = D("k")
m = B("m")
a = D("a")

d.v = a
d.u = c
l.y = m
l.s = m
l.q = m
c.r = l
c.x = l
c.z = m
k.z = m
k.v = m
k.x = l
k.u = c
m.y = l
m.s = l
m.q = l
a.z = l
a.x = m
a.v = m
a.u = c
assert d.v.v.s.q.txt == "m"