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

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

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

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

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

m = A("m")
a = B("a")
k = C("k")
d = D("d")
c = E("c")
n = B("n")
e = E("e")

m.q = k
a.w = d
a.v = d
a.r = n
a.q = m
k.z = m
k.y = m
k.x = a
d.r = m
d.z = m
d.x = m
d.o = k
c.s = n
c.u = k
c.y = m
c.w = e
c.z = d
n.w = d
n.v = d
n.r = a
n.q = m
e.s = n
e.u = k
e.y = m
e.w = c
e.z = d
assert c.y.q.z.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

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

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

m = A("m")
a = B("a")
k = C("k")
d = D("d")
c = E("c")
n = B("n")
e = E("e")

m.q = k
a.w = d
a.v = d
a.r = n
a.q = m
k.z = m
k.y = m
k.x = a
d.r = m
d.z = m
d.x = m
d.o = k
c.s = n
c.u = k
c.y = m
c.w = e
c.z = d
n.w = d
n.v = d
n.r = a
n.q = m
e.s = n
e.u = k
e.y = m
e.w = c
e.z = d
assert c.y.q.z.q.y.txt == "m"