class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: B = None
        self.u: E = None
        self.txt = txt

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

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

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

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

a = A("a")
b = B("b")
m = C("m")
n = D("n")
j = E("j")

a.s = b
a.z = b
a.u = j
b.w = m
b.t = m
b.o = j
b.z = j
b.x = n
m.q = j
m.t = j
m.x = a
n.o = b
j.y = a
j.r = b
j.w = m
j.p = n
assert j.p.o.x.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: B = None
        self.u: E = None
        self.txt = txt

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

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

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

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

a = A("a")
b = B("b")
m = C("m")
n = D("n")
j = E("j")

a.s = b
a.z = b
a.u = j
b.w = m
b.t = m
b.o = j
b.z = j
b.x = n
m.q = j
m.t = j
m.x = a
n.o = b
j.y = a
j.r = b
j.w = m
j.p = n
assert j.p.o.x.o.x.txt == "n"