class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.w: E = None
        self.y: A = None
        self.q: B = None
        self.r: E = None
        self.s: F = None
        self.u: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.z: H = None
        self.q: E = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.t: G = None
        self.x: B = None
        self.w: A = None
        self.s: B = None
        self.txt = txt

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

c.w = e
c.u = d
e.p = b
e.o = f
e.s = m
e.v = m
a.t = f
a.w = f
a.r = f
a.y = c
a.u = c
a.q = e
a.s = b
n.t = m
f.s = a
f.t = a
f.z = b
f.y = n
f.v = m
f.r = c
b.v = f
b.q = f
b.z = m
d.o = e
d.x = a
d.s = a
m.t = d
m.x = e
m.s = e
m.w = c
g.t = d
g.x = e
g.s = e
g.w = c
assert m.w.u.s.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.w: E = None
        self.y: A = None
        self.q: B = None
        self.r: E = None
        self.s: F = None
        self.u: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.z: H = None
        self.q: E = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.t: G = None
        self.x: B = None
        self.w: A = None
        self.s: B = None
        self.txt = txt

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

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