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

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

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

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

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

k = A("k")
f = B("f")
n = C("n")
c = D("c")
g = E("g")
h = E("h")
m = C("m")

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

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

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

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

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

k = A("k")
f = B("f")
n = C("n")
c = D("c")
g = E("g")
h = E("h")
m = C("m")

k.q = g
k.p = g
k.w = h
k.v = f
f.o = k
n.q = k
n.z = c
n.v = f
n.t = m
n.u = h
c.w = k
c.y = k
c.q = f
c.x = h
g.r = n
g.z = c
g.q = c
g.s = h
h.r = m
h.z = c
h.q = c
h.s = g
m.q = k
m.z = c
m.v = f
m.t = n
m.u = g
assert m.v.o.q.r.t.t.txt == "n"