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

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.v: F = None
        self.s: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: D = None
        self.v: G = None
        self.s: B = None
        self.t: D = None
        self.z: H = None
        self.o: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: J = None
        self.s: F = None
        self.p: J = None
        self.x: D = None
        self.txt = txt

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

class J:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: F = None
        self.z: H = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.v: F = None
        self.s: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: D = None
        self.v: G = None
        self.s: B = None
        self.t: D = None
        self.z: H = None
        self.o: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: J = None
        self.s: F = None
        self.p: J = None
        self.x: D = None
        self.txt = txt

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

class J:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: F = None
        self.z: H = None
        self.txt = txt

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

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