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

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

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

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

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

m = A("m")
l = B("l")
n = C("n")
i = D("i")
c = E("c")
a = E("a")

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

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

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

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

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

m = A("m")
l = B("l")
n = C("n")
i = D("i")
c = E("c")
a = E("a")

m.x = n
m.v = l
l.s = i
l.y = i
l.q = m
l.z = a
n.o = m
i.u = n
c.r = l
c.w = l
c.y = m
c.u = m
c.q = i
a.r = l
a.w = l
a.y = m
a.u = m
a.q = i
assert c.r.z.r.y.txt == "i"