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

class B:
    def __init__(self, txt: str):
        self.p: H = None
        self.z: G = None
        self.y: F = None
        self.q: D = None
        self.x: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: G = None
        self.t: D = None
        self.z: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: H = None
        self.o: 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.q: D = None
        self.z: C = None
        self.y: D = None
        self.t: C = None
        self.p: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: H = None
        self.txt = txt

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

n = A("n")
a = B("a")
h = C("h")
c = D("c")
g = E("g")
f = F("f")
l = G("l")
m = H("m")

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

class B:
    def __init__(self, txt: str):
        self.p: H = None
        self.z: G = None
        self.y: F = None
        self.q: D = None
        self.x: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: G = None
        self.t: D = None
        self.z: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: H = None
        self.o: 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.q: D = None
        self.z: C = None
        self.y: D = None
        self.t: C = None
        self.p: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: H = None
        self.txt = txt

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

n = A("n")
a = B("a")
h = C("h")
c = D("c")
g = E("g")
f = F("f")
l = G("l")
m = H("m")

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