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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.t: E = None
        self.o: A = None
        self.p: A = None
        self.y: C = None
        self.txt = txt

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

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

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

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

e.q = l
e.y = i
g.x = n
g.y = n
g.t = i
g.o = d
g.p = e
n.w = g
n.v = i
n.q = l
c.q = k
c.v = g
c.z = m
i.y = n
k.y = n
d.q = c
d.y = i
l.q = k
l.v = g
l.z = m
m.q = i
m.v = g
m.z = l
assert c.q.y.w.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.t: E = None
        self.o: A = None
        self.p: A = None
        self.y: C = None
        self.txt = txt

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

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

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

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

e.q = l
e.y = i
g.x = n
g.y = n
g.t = i
g.o = d
g.p = e
n.w = g
n.v = i
n.q = l
c.q = k
c.v = g
c.z = m
i.y = n
k.y = n
d.q = c
d.y = i
l.q = k
l.v = g
l.z = m
m.q = i
m.v = g
m.z = l
assert c.q.y.w.y.w.txt == "g"