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

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

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

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

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

i = A("i")
c = B("c")
a = C("a")
n = D("n")
g = E("g")
b = C("b")

i.z = c
i.x = c
c.u = b
c.y = i
c.p = i
c.v = g
a.x = n
a.p = n
a.u = n
a.s = c
n.s = i
n.x = b
n.v = b
n.y = b
g.q = n
b.x = n
b.p = n
b.u = n
b.s = c
assert g.q.y.s.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: B = None
        self.txt = txt

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

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

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

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

i = A("i")
c = B("c")
a = C("a")
n = D("n")
g = E("g")
b = C("b")

i.z = c
i.x = c
c.u = b
c.y = i
c.p = i
c.v = g
a.x = n
a.p = n
a.u = n
a.s = c
n.s = i
n.x = b
n.v = b
n.y = b
g.q = n
b.x = n
b.p = n
b.u = n
b.s = c
assert g.q.y.s.v.q.txt == "n"