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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.y: C = None
        self.s: C = None
        self.x: D = None
        self.txt = txt

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

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

m = A("m")
l = B("l")
h = C("h")
d = D("d")
k = D("k")
e = C("e")

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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.y: C = None
        self.s: C = None
        self.x: D = None
        self.txt = txt

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

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

m = A("m")
l = B("l")
h = C("h")
d = D("d")
k = D("k")
e = C("e")

m.q = d
m.x = h
m.y = k
m.r = l
l.t = m
l.y = e
l.s = e
l.x = k
h.w = k
h.p = k
h.v = m
h.u = d
d.u = l
d.z = l
d.t = m
d.w = e
k.u = l
k.z = l
k.t = m
k.w = e
e.w = d
e.p = d
e.u = d
e.v = m
assert e.v.y.t.x.v.q.txt == "d"