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

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

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

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

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

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

a.q = d
a.r = e
a.z = i
a.x = n
d.s = b
d.t = b
d.u = e
d.q = n
d.p = n
n.r = a
n.v = b
n.t = d
i.s = a
i.r = d
b.y = n
b.v = d
b.u = i
e.q = d
e.r = a
e.z = i
e.x = n
assert e.r.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: A = None
        self.z: D = None
        self.x: C = None
        self.txt = txt

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

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

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

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

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

a.q = d
a.r = e
a.z = i
a.x = n
d.s = b
d.t = b
d.u = e
d.q = n
d.p = n
n.r = a
n.v = b
n.t = d
i.s = a
i.r = d
b.y = n
b.v = d
b.u = i
e.q = d
e.r = a
e.z = i
e.x = n
assert e.r.q.p.txt == "n"