class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: H = None
        self.w: D = None
        self.o: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.s: A = None
        self.r: G = None
        self.w: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: G = None
        self.r: G = None
        self.s: G = None
        self.p: C = None
        self.v: G = None
        self.w: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: G = None
        self.x: E = None
        self.w: D = None
        self.q: G = None
        self.z: E = None
        self.t: D = None
        self.y: C = None
        self.v: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: A = None
        self.q: F = None
        self.r: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: B = None
        self.y: F = None
        self.z: D = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.s: A = None
        self.r: G = None
        self.w: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: G = None
        self.r: G = None
        self.s: G = None
        self.p: C = None
        self.v: G = None
        self.w: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: G = None
        self.x: E = None
        self.w: D = None
        self.q: G = None
        self.z: E = None
        self.t: D = None
        self.y: C = None
        self.v: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: A = None
        self.q: F = None
        self.r: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: B = None
        self.y: F = None
        self.z: D = None
        self.txt = txt

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

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