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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

e.x = d
e.q = d
e.u = l
i.v = a
i.q = m
i.y = m
i.u = e
b.z = e
b.r = e
b.u = l
a.t = e
a.u = m
a.w = n
n.y = e
l.z = e
l.r = e
l.u = d
d.z = e
d.r = e
d.u = b
m.v = a
m.q = i
m.y = i
m.u = e
assert d.r.u.z.x.z.x.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: C = None
        self.q: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

e.x = d
e.q = d
e.u = l
i.v = a
i.q = m
i.y = m
i.u = e
b.z = e
b.r = e
b.u = l
a.t = e
a.u = m
a.w = n
n.y = e
l.z = e
l.r = e
l.u = d
d.z = e
d.r = e
d.u = b
m.v = a
m.q = i
m.y = i
m.u = e
assert d.r.u.z.x.z.x.r.q.txt == "d"