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

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

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

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.w: B = None
        self.u: F = None
        self.y: A = None
        self.p: C = None
        self.txt = txt

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

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

i = A("i")
h = B("h")
f = C("f")
e = D("e")
n = E("n")
c = F("c")
k = F("k")
m = C("m")

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

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

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

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.w: B = None
        self.u: F = None
        self.y: A = None
        self.p: C = None
        self.txt = txt

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

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

i = A("i")
h = B("h")
f = C("f")
e = D("e")
n = E("n")
c = F("c")
k = F("k")
m = C("m")

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