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

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

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

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

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

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

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

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

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

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

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

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

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