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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: B = None
        self.r: C = None
        self.z: D = None
        self.txt = txt

i = A("i")
c = B("c")
m = C("m")
a = D("a")
e = E("e")
b = E("b")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: B = None
        self.r: C = None
        self.z: D = None
        self.txt = txt

i = A("i")
c = B("c")
m = C("m")
a = D("a")
e = E("e")
b = E("b")

i.x = m
i.o = b
c.y = e
m.x = e
m.v = i
m.y = a
m.r = a
m.t = c
a.o = c
a.z = i
a.w = b
e.q = m
e.r = m
e.o = c
e.z = a
b.q = m
b.r = m
b.o = c
b.z = a
assert m.t.y.z.z.o.q.txt == "m"