class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: C = None
        self.s: B = None
        self.w: B = None
        self.r: F = None
        self.txt = txt

m = A("m")
c = B("c")
e = C("e")
g = D("g")
d = E("d")
k = F("k")
b = F("b")
h = C("h")
n = F("n")

m.u = b
c.u = d
c.z = d
c.t = g
c.o = g
c.q = n
c.p = e
e.s = h
g.w = d
d.z = e
k.p = e
k.u = e
k.s = c
k.w = c
k.r = b
b.p = h
b.u = e
b.s = c
b.w = c
b.r = k
h.s = e
n.p = h
n.u = h
n.s = c
n.w = c
n.r = k
assert d.z.s.s.s.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: C = None
        self.s: B = None
        self.w: B = None
        self.r: F = None
        self.txt = txt

m = A("m")
c = B("c")
e = C("e")
g = D("g")
d = E("d")
k = F("k")
b = F("b")
h = C("h")
n = F("n")

m.u = b
c.u = d
c.z = d
c.t = g
c.o = g
c.q = n
c.p = e
e.s = h
g.w = d
d.z = e
k.p = e
k.u = e
k.s = c
k.w = c
k.r = b
b.p = h
b.u = e
b.s = c
b.w = c
b.r = k
h.s = e
n.p = h
n.u = h
n.s = c
n.w = c
n.r = k
assert d.z.s.s.s.s.s.s.s.txt == "h"