class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: H = None
        self.t: F = None
        self.p: A = None
        self.o: I = None
        self.r: E = None
        self.x: D = None
        self.y: H = None
        self.w: J = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: B = None
        self.w: B = None
        self.y: G = None
        self.p: J = None
        self.x: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: I = None
        self.t: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: H = None
        self.y: E = None
        self.o: H = None
        self.u: A = None
        self.r: B = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.v: E = None
        self.y: E = None
        self.x: G = None
        self.q: I = None
        self.p: J = None
        self.u: A = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: J = None
        self.v: A = None
        self.t: B = None
        self.txt = txt

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

h = A("h")
i = B("i")
g = C("g")
d = D("d")
m = E("m")
f = F("f")
j = G("j")
n = H("n")
l = I("l")
a = J("a")

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

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

class C:
    def __init__(self, txt: str):
        self.q: H = None
        self.t: F = None
        self.p: A = None
        self.o: I = None
        self.r: E = None
        self.x: D = None
        self.y: H = None
        self.w: J = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: B = None
        self.w: B = None
        self.y: G = None
        self.p: J = None
        self.x: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: I = None
        self.t: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: H = None
        self.y: E = None
        self.o: H = None
        self.u: A = None
        self.r: B = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.v: E = None
        self.y: E = None
        self.x: G = None
        self.q: I = None
        self.p: J = None
        self.u: A = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: J = None
        self.v: A = None
        self.t: B = None
        self.txt = txt

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

h = A("h")
i = B("i")
g = C("g")
d = D("d")
m = E("m")
f = F("f")
j = G("j")
n = H("n")
l = I("l")
a = J("a")

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