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

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

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

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

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

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

n.y = l
n.v = a
i.v = l
a.t = l
a.p = l
a.x = l
a.w = b
a.s = e
l.y = n
e.w = n
e.p = n
b.v = l
assert n.v.s.p.y.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.v: C = None
        self.txt = txt

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

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

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

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

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

n.y = l
n.v = a
i.v = l
a.t = l
a.p = l
a.x = l
a.w = b
a.s = e
l.y = n
e.w = n
e.p = n
b.v = l
assert n.v.s.p.y.y.v.txt == "a"