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

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.p: E = None
        self.u: E = None
        self.r: D = None
        self.o: D = None
        self.txt = txt

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

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

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

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

n.q = g
i.w = n
i.p = c
i.u = l
i.r = g
i.o = g
a.r = g
a.z = c
a.w = n
g.q = a
g.t = l
c.q = n
l.q = n
assert a.w.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.p: E = None
        self.u: E = None
        self.r: D = None
        self.o: D = None
        self.txt = txt

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

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

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

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

n.q = g
i.w = n
i.p = c
i.u = l
i.r = g
i.o = g
a.r = g
a.z = c
a.w = n
g.q = a
g.t = l
c.q = n
l.q = n
assert a.w.q.q.txt == "a"