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

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

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

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

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

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

d.o = n
d.v = i
n.s = i
n.p = d
e.r = d
e.x = i
e.p = k
k.u = d
k.v = e
i.o = e
i.y = n
assert d.v.y.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: E = None
        self.txt = txt

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

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

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

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

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

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