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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: A = None
        self.q: C = None
        self.p: F = None
        self.r: B = None
        self.o: D = None
        self.s: A = None
        self.txt = txt

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: A = None
        self.q: C = None
        self.p: F = None
        self.r: B = None
        self.o: D = None
        self.s: A = None
        self.txt = txt

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

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