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

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.p: A = None
        self.r: C = None
        self.o: C = None
        self.y: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: D = None
        self.z: D = None
        self.x: D = None
        self.p: A = None
        self.txt = txt

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

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

k = A("k")
a = B("a")
g = C("g")
e = D("e")
c = E("c")
m = B("m")

k.q = c
k.s = g
k.p = a
k.u = a
a.s = g
a.r = g
a.o = g
a.p = k
a.y = k
g.o = c
g.v = e
g.z = e
g.x = e
g.p = k
e.z = k
e.u = c
c.q = m
m.s = g
m.r = g
m.o = g
m.p = k
m.y = k
assert m.y.q.q.y.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.s: C = None
        self.p: B = None
        self.u: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.p: A = None
        self.r: C = None
        self.o: C = None
        self.y: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: D = None
        self.z: D = None
        self.x: D = None
        self.p: A = None
        self.txt = txt

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

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

k = A("k")
a = B("a")
g = C("g")
e = D("e")
c = E("c")
m = B("m")

k.q = c
k.s = g
k.p = a
k.u = a
a.s = g
a.r = g
a.o = g
a.p = k
a.y = k
g.o = c
g.v = e
g.z = e
g.x = e
g.p = k
e.z = k
e.u = c
c.q = m
m.s = g
m.r = g
m.o = g
m.p = k
m.y = k
assert m.y.q.q.y.q.q.txt == "m"