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

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

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

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

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

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

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

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

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

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

k.r = j
k.p = b
k.u = b
k.s = n
d.v = n
d.z = i
d.y = i
d.q = c
a.w = d
a.q = b
a.r = n
a.v = k
b.y = a
i.w = n
i.r = n
i.q = j
i.v = l
j.y = a
n.v = d
n.z = i
n.y = i
n.q = j
c.y = a
l.r = b
l.u = b
l.p = j
l.s = d
assert k.p.y.r.q.y.txt == "a"