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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

k = A("k")
d = B("d")
g = C("g")
a = D("a")
n = E("n")
j = E("j")
e = A("e")
m = B("m")
i = D("i")
c = B("c")

k.x = a
k.u = m
k.z = e
d.p = e
g.w = a
g.z = a
g.p = d
g.x = n
g.q = m
a.q = g
a.o = g
a.s = i
a.w = c
n.x = g
j.x = g
e.x = a
e.u = c
e.z = k
m.p = e
i.q = g
i.o = g
i.s = a
i.w = c
c.p = e
assert g.q.p.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.u: B = None
        self.z: A = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

k = A("k")
d = B("d")
g = C("g")
a = D("a")
n = E("n")
j = E("j")
e = A("e")
m = B("m")
i = D("i")
c = B("c")

k.x = a
k.u = m
k.z = e
d.p = e
g.w = a
g.z = a
g.p = d
g.x = n
g.q = m
a.q = g
a.o = g
a.s = i
a.w = c
n.x = g
j.x = g
e.x = a
e.u = c
e.z = k
m.p = e
i.q = g
i.o = g
i.s = a
i.w = c
c.p = e
assert g.q.p.u.p.txt == "e"