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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: A = None
        self.w: C = None
        self.z: G = None
        self.r: E = None
        self.s: A = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: A = None
        self.w: C = None
        self.z: G = None
        self.r: E = None
        self.s: A = None
        self.txt = txt

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

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

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

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

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