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

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: H = None
        self.x: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.r: C = None
        self.x: H = None
        self.z: H = None
        self.y: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: G = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: H = None
        self.x: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.r: C = None
        self.x: H = None
        self.z: H = None
        self.y: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: G = None
        self.txt = txt

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

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

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

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

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