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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

d.o = k
d.w = l
d.q = l
d.v = e
d.r = n
l.q = n
l.u = n
l.r = e
n.v = d
e.q = k
e.v = k
k.u = d
assert n.v.r.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.w: B = None
        self.q: B = None
        self.v: D = None
        self.r: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

d.o = k
d.w = l
d.q = l
d.v = e
d.r = n
l.q = n
l.u = n
l.r = e
n.v = d
e.q = k
e.v = k
k.u = d
assert n.v.r.v.v.txt == "e"