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

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

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

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

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

m = A("m")
k = B("k")
j = C("j")
i = D("i")
d = E("d")

m.r = d
m.w = i
m.x = k
m.y = j
k.z = m
j.t = m
j.y = m
j.v = k
j.s = d
j.o = i
i.o = d
d.s = i
d.r = k
d.y = k
d.p = k
assert i.o.y.z.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.w: D = None
        self.x: B = None
        self.y: C = None
        self.txt = txt

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

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

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

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

m = A("m")
k = B("k")
j = C("j")
i = D("i")
d = E("d")

m.r = d
m.w = i
m.x = k
m.y = j
k.z = m
j.t = m
j.y = m
j.v = k
j.s = d
j.o = i
i.o = d
d.s = i
d.r = k
d.y = k
d.p = k
assert i.o.y.z.r.p.txt == "k"