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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.y: F = None
        self.r: B = None
        self.s: C = None
        self.x: E = None
        self.w: D = None
        self.v: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.r: G = None
        self.x: G = None
        self.t: A = None
        self.z: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.y: F = None
        self.r: B = None
        self.s: C = None
        self.x: E = None
        self.w: D = None
        self.v: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.r: G = None
        self.x: G = None
        self.t: A = None
        self.z: C = None
        self.txt = txt

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

n.x = b
g.w = c
c.r = d
c.w = d
c.x = a
c.z = b
c.s = f
c.q = f
c.t = i
b.y = a
b.w = c
b.q = n
d.y = a
d.r = g
d.s = c
d.x = i
d.w = b
d.v = b
a.s = g
a.u = i
a.x = b
a.v = c
h.r = f
h.x = f
h.t = n
h.z = c
i.y = a
i.r = g
i.s = c
i.x = d
i.w = b
i.v = b
f.r = h
f.x = h
f.t = n
f.z = c
assert d.s.t.w.y.x.q.x.y.txt == "a"