class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.w: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: F = None
        self.x: E = None
        self.o: C = None
        self.t: C = None
        self.s: A = None
        self.txt = txt

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

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

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

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

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

m = A("m")
e = B("e")
h = C("h")
d = D("d")
g = E("g")
a = F("a")
c = G("c")

m.o = g
m.w = h
e.y = a
e.x = g
e.o = h
e.t = h
e.s = m
h.x = c
h.s = c
h.q = e
d.s = c
d.u = h
d.q = h
d.v = h
g.t = d
g.u = c
g.r = a
g.z = h
a.z = d
c.w = a
c.o = m
c.x = e
assert a.z.u.q.y.z.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.w: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: F = None
        self.x: E = None
        self.o: C = None
        self.t: C = None
        self.s: A = None
        self.txt = txt

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

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

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

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

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

m = A("m")
e = B("e")
h = C("h")
d = D("d")
g = E("g")
a = F("a")
c = G("c")

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