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

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

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: B = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: B = None
        self.txt = txt

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

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

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