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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.t: G = None
        self.p: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.v: A = None
        self.p: A = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.t: G = None
        self.p: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.v: A = None
        self.p: A = None
        self.txt = txt

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

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

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

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

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

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