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

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

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

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

i.u = b
i.y = b
k.s = b
b.t = m
b.v = c
b.x = i
b.o = i
c.q = i
c.s = i
m.u = c
m.r = i
m.p = b
m.z = k
assert k.s.x.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

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

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

i.u = b
i.y = b
k.s = b
b.t = m
b.v = c
b.x = i
b.o = i
c.q = i
c.s = i
m.u = c
m.r = i
m.p = b
m.z = k
assert k.s.x.u.t.txt == "m"