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

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

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

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

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

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

j.z = a
j.y = a
j.r = m
j.x = b
j.o = b
c.x = b
c.z = b
c.v = j
c.r = m
d.t = a
d.u = m
b.s = c
a.p = c
a.u = j
a.o = b
m.z = a
m.y = a
m.r = j
m.x = b
m.o = b
assert a.p.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.y: E = None
        self.r: A = None
        self.x: D = None
        self.o: D = None
        self.txt = txt

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

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

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

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

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

j.z = a
j.y = a
j.r = m
j.x = b
j.o = b
c.x = b
c.z = b
c.v = j
c.r = m
d.t = a
d.u = m
b.s = c
a.p = c
a.u = j
a.o = b
m.z = a
m.y = a
m.r = j
m.x = b
m.o = b
assert a.p.z.s.txt == "c"