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

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

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.w: E = None
        self.x: C = None
        self.txt = txt

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

m = A("m")
i = B("i")
l = C("l")
b = D("b")
f = E("f")
a = B("a")
k = D("k")
e = A("e")

m.x = l
m.z = l
m.q = a
m.u = a
m.y = k
i.o = b
l.q = e
l.o = m
l.z = b
l.r = b
b.p = f
b.w = f
b.x = l
f.q = a
a.o = b
k.p = f
k.w = f
k.x = l
e.x = l
e.z = l
e.q = a
e.y = b
e.u = i
assert m.u.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: B = None
        self.y: D = None
        self.z: C = None
        self.u: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.w: E = None
        self.x: C = None
        self.txt = txt

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

m = A("m")
i = B("i")
l = C("l")
b = D("b")
f = E("f")
a = B("a")
k = D("k")
e = A("e")

m.x = l
m.z = l
m.q = a
m.u = a
m.y = k
i.o = b
l.q = e
l.o = m
l.z = b
l.r = b
b.p = f
b.w = f
b.x = l
f.q = a
a.o = b
k.p = f
k.w = f
k.x = l
e.x = l
e.z = l
e.q = a
e.y = b
e.u = i
assert m.u.o.x.txt == "l"