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

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.t: A = None
        self.p: E = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.t: A = None
        self.p: E = None
        self.txt = txt

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

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

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

m.y = k
m.z = k
m.o = f
a.r = e
f.q = e
f.p = e
f.t = m
k.s = f
k.u = e
k.r = e
k.p = a
e.w = a
e.s = a
e.z = k
e.x = f
assert a.r.x.t.txt == "m"