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

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

class C:
    def __init__(self, txt: str):
        self.w: H = None
        self.q: E = None
        self.u: A = None
        self.x: F = None
        self.s: A = None
        self.y: F = None
        self.v: F = None
        self.z: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: G = None
        self.o: E = None
        self.u: I = None
        self.q: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.w: H = None
        self.x: C = None
        self.p: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: I = None
        self.u: A = None
        self.r: C = None
        self.txt = txt

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

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

k.y = g
k.x = g
h.y = d
h.x = j
h.u = g
d.w = g
d.z = g
d.q = n
d.u = k
d.s = k
d.x = c
d.y = c
d.v = l
j.w = f
j.o = n
j.u = b
j.q = d
n.p = f
c.v = j
c.s = h
f.w = g
f.x = d
f.p = j
g.p = h
g.o = b
g.u = k
g.r = d
b.p = c
b.q = d
b.z = h
b.v = g
b.u = k
b.r = k
b.s = n
l.v = j
l.s = h
assert j.q.q.p.p.o.p.p.o.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: H = None
        self.x: H = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: H = None
        self.q: E = None
        self.u: A = None
        self.x: F = None
        self.s: A = None
        self.y: F = None
        self.v: F = None
        self.z: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: G = None
        self.o: E = None
        self.u: I = None
        self.q: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.w: H = None
        self.x: C = None
        self.p: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: I = None
        self.u: A = None
        self.r: C = None
        self.txt = txt

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

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

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