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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: B = None
        self.w: B = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: B = None
        self.w: B = None
        self.txt = txt

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

a.o = c
a.s = c
a.x = c
a.y = e
a.z = j
m.p = c
m.z = e
c.r = e
e.o = c
j.v = c
j.o = m
j.w = m
assert j.v.r.o.r.o.txt == "c"