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

class B:
    def __init__(self, txt: str):
        self.p: J = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.p: F = None
        self.o: J = None
        self.v: B = None
        self.q: A = None
        self.u: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: I = None
        self.y: B = None
        self.w: J = None
        self.s: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.v: E = None
        self.u: D = None
        self.p: E = None
        self.o: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: G = None
        self.o: A = None
        self.s: A = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: B = None
        self.q: D = None
        self.u: E = None
        self.o: B = None
        self.s: B = None
        self.v: A = None
        self.x: D = None
        self.w: E = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.o: E = None
        self.r: E = None
        self.q: H = None
        self.z: C = None
        self.x: G = None
        self.u: F = None
        self.t: H = None
        self.txt = txt

b = A("b")
k = B("k")
f = C("f")
n = D("n")
l = E("l")
d = F("d")
c = G("c")
g = H("g")
m = I("m")
i = J("i")

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

class B:
    def __init__(self, txt: str):
        self.p: J = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.p: F = None
        self.o: J = None
        self.v: B = None
        self.q: A = None
        self.u: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: I = None
        self.y: B = None
        self.w: J = None
        self.s: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.v: E = None
        self.u: D = None
        self.p: E = None
        self.o: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: G = None
        self.o: A = None
        self.s: A = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: B = None
        self.q: D = None
        self.u: E = None
        self.o: B = None
        self.s: B = None
        self.v: A = None
        self.x: D = None
        self.w: E = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.o: E = None
        self.r: E = None
        self.q: H = None
        self.z: C = None
        self.x: G = None
        self.u: F = None
        self.t: H = None
        self.txt = txt

b = A("b")
k = B("k")
f = C("f")
n = D("n")
l = E("l")
d = F("d")
c = G("c")
g = H("g")
m = I("m")
i = J("i")

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