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

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

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

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

e = A("e")
d = B("d")
m = C("m")
j = D("j")
l = C("l")
i = D("i")

e.y = l
e.v = m
e.u = d
e.p = i
d.w = l
m.r = d
m.s = d
m.u = e
m.q = i
j.v = d
j.z = m
l.r = d
l.s = d
l.u = e
l.q = j
i.v = d
i.z = m
assert m.u.u.w.u.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.v: C = None
        self.u: B = None
        self.p: D = None
        self.txt = txt

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

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

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

e = A("e")
d = B("d")
m = C("m")
j = D("j")
l = C("l")
i = D("i")

e.y = l
e.v = m
e.u = d
e.p = i
d.w = l
m.r = d
m.s = d
m.u = e
m.q = i
j.v = d
j.z = m
l.r = d
l.s = d
l.u = e
l.q = j
i.v = d
i.z = m
assert m.u.u.w.u.v.u.txt == "e"