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

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

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.w: A = None
        self.t: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.q: A = None
        self.t: E = None
        self.z: A = None
        self.txt = txt

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

i = A("i")
l = B("l")
n = C("n")
d = D("d")
a = E("a")

i.s = l
i.p = a
i.r = n
l.r = d
l.o = d
l.v = a
n.o = a
n.t = a
n.w = i
d.r = a
d.t = a
d.q = i
d.z = i
a.r = n
a.z = d
assert l.v.z.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.p: E = None
        self.r: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.w: A = None
        self.t: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.q: A = None
        self.t: E = None
        self.z: A = None
        self.txt = txt

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

i = A("i")
l = B("l")
n = C("n")
d = D("d")
a = E("a")

i.s = l
i.p = a
i.r = n
l.r = d
l.o = d
l.v = a
n.o = a
n.t = a
n.w = i
d.r = a
d.t = a
d.q = i
d.z = i
a.r = n
a.z = d
assert l.v.z.r.r.txt == "n"