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

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

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

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

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

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

b.p = e
b.z = a
a.v = e
n.w = a
n.r = l
n.q = e
l.q = a
e.o = n
e.t = n
e.x = l
e.y = l
e.r = a
assert a.v.y.q.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: B = None
        self.txt = txt

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

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

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

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

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

b.p = e
b.z = a
a.v = e
n.w = a
n.r = l
n.q = e
l.q = a
e.o = n
e.t = n
e.x = l
e.y = l
e.r = a
assert a.v.y.q.v.o.txt == "n"