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

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

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.w: G = None
        self.s: H = None
        self.x: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: G = None
        self.v: G = None
        self.r: G = None
        self.x: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: A = None
        self.s: F = None
        self.o: C = None
        self.u: C = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.w: G = None
        self.s: H = None
        self.x: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: G = None
        self.v: G = None
        self.r: G = None
        self.x: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: A = None
        self.s: F = None
        self.o: C = None
        self.u: C = None
        self.txt = txt

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

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