class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.u: F = None
        self.o: E = None
        self.y: G = None
        self.w: C = None
        self.s: C = None
        self.x: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.x: D = None
        self.t: D = None
        self.p: D = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.u: F = None
        self.o: E = None
        self.y: G = None
        self.w: C = None
        self.s: C = None
        self.x: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.x: D = None
        self.t: D = None
        self.p: D = None
        self.txt = txt

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

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

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