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

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.p: I = None
        self.r: G = None
        self.y: F = None
        self.z: A = None
        self.q: G = None
        self.u: I = None
        self.o: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.s: F = None
        self.x: E = None
        self.r: G = None
        self.v: F = None
        self.o: H = None
        self.z: I = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: H = None
        self.y: I = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: I = None
        self.o: I = None
        self.r: A = None
        self.t: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.t: I = None
        self.v: D = None
        self.q: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: I = None
        self.u: D = None
        self.o: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: D = None
        self.v: E = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: F = None
        self.u: A = None
        self.t: G = None
        self.v: C = None
        self.txt = txt

c = A("c")
e = B("e")
g = C("g")
n = D("n")
a = E("a")
b = F("b")
f = G("f")
d = H("d")
k = I("k")

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

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.p: I = None
        self.r: G = None
        self.y: F = None
        self.z: A = None
        self.q: G = None
        self.u: I = None
        self.o: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.s: F = None
        self.x: E = None
        self.r: G = None
        self.v: F = None
        self.o: H = None
        self.z: I = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: H = None
        self.y: I = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: I = None
        self.o: I = None
        self.r: A = None
        self.t: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.t: I = None
        self.v: D = None
        self.q: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: I = None
        self.u: D = None
        self.o: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: D = None
        self.v: E = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: F = None
        self.u: A = None
        self.t: G = None
        self.v: C = None
        self.txt = txt

c = A("c")
e = B("e")
g = C("g")
n = D("n")
a = E("a")
b = F("b")
f = G("f")
d = H("d")
k = I("k")

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