class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: F = None
        self.o: F = None
        self.y: F = None
        self.z: D = None
        self.w: E = None
        self.t: H = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: F = None
        self.z: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.r: A = None
        self.x: A = None
        self.y: A = None
        self.q: A = None
        self.u: F = None
        self.p: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: H = None
        self.p: B = None
        self.y: F = None
        self.u: C = None
        self.s: G = None
        self.v: B = None
        self.w: G = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.o: E = None
        self.p: G = None
        self.t: E = None
        self.v: D = None
        self.r: A = None
        self.u: E = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: F = None
        self.z: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.r: A = None
        self.x: A = None
        self.y: A = None
        self.q: A = None
        self.u: F = None
        self.p: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: H = None
        self.p: B = None
        self.y: F = None
        self.u: C = None
        self.s: G = None
        self.v: B = None
        self.w: G = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.o: E = None
        self.p: G = None
        self.t: E = None
        self.v: D = None
        self.r: A = None
        self.u: E = None
        self.txt = txt

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

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