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

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

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.u: E = None
        self.y: D = None
        self.q: A = None
        self.w: E = None
        self.p: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: A = None
        self.r: F = None
        self.q: A = None
        self.v: B = None
        self.t: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: C = None
        self.s: E = None
        self.x: F = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.u: E = None
        self.y: D = None
        self.q: A = None
        self.w: E = None
        self.p: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: A = None
        self.r: F = None
        self.q: A = None
        self.v: B = None
        self.t: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: C = None
        self.s: E = None
        self.x: F = None
        self.txt = txt

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

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