class A:
    def __init__(self, txt: str):
        self.u: G = None
        self.v: C = None
        self.w: I = None
        self.s: F = None
        self.o: F = None
        self.x: G = None
        self.q: F = None
        self.z: B = None
        self.r: D = None
        self.y: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: J = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.p: C = None
        self.s: I = None
        self.r: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: C = None
        self.w: D = None
        self.t: E = None
        self.v: I = None
        self.p: A = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.s: G = None
        self.y: F = None
        self.z: H = None
        self.o: J = None
        self.t: D = None
        self.r: G = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: J = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.p: C = None
        self.s: I = None
        self.r: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: C = None
        self.w: D = None
        self.t: E = None
        self.v: I = None
        self.p: A = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.s: G = None
        self.y: F = None
        self.z: H = None
        self.o: J = None
        self.t: D = None
        self.r: G = None
        self.txt = txt

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

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

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