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

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

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

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

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

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

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

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

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

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

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