class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: G = None
        self.o: A = None
        self.x: F = None
        self.p: E = None
        self.u: G = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: C = None
        self.r: C = None
        self.w: E = None
        self.s: A = None
        self.y: E = None
        self.v: A = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: G = None
        self.o: A = None
        self.x: F = None
        self.p: E = None
        self.u: G = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: C = None
        self.r: C = None
        self.w: E = None
        self.s: A = None
        self.y: E = None
        self.v: A = None
        self.txt = txt

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

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