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

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

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

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

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

c = A("c")
n = B("n")
i = C("i")
d = D("d")
k = E("k")

c.x = d
c.r = d
n.v = k
n.z = k
n.s = i
i.s = d
i.o = n
i.y = c
d.r = i
d.p = i
k.s = i
k.p = n
assert d.r.o.s.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.r: D = None
        self.txt = txt

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

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

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

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

c = A("c")
n = B("n")
i = C("i")
d = D("d")
k = E("k")

c.x = d
c.r = d
n.v = k
n.z = k
n.s = i
i.s = d
i.o = n
i.y = c
d.r = i
d.p = i
k.s = i
k.p = n
assert d.r.o.s.s.p.txt == "i"