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

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

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

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

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

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

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

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

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

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

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

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

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