class A:
    def __init__(self, txt: str):
        self.u: J = None
        self.x: E = None
        self.t: G = None
        self.q: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: J = None
        self.w: C = None
        self.x: A = None
        self.z: C = None
        self.t: A = None
        self.y: F = None
        self.q: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: E = None
        self.r: I = None
        self.x: J = None
        self.t: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.z: H = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: G = None
        self.v: I = None
        self.o: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: H = None
        self.z: I = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: D = None
        self.x: I = None
        self.s: F = None
        self.txt = txt

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

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

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

f.u = l
f.x = d
f.t = a
f.q = b
e.r = l
e.w = h
e.z = h
e.x = f
e.t = f
e.y = b
e.q = n
h.u = g
h.z = d
h.r = m
h.x = l
h.t = a
g.x = b
g.z = n
d.s = h
d.z = f
b.y = h
b.t = a
b.v = m
b.o = e
a.u = n
a.z = m
n.o = g
n.x = m
n.s = b
m.t = n
m.s = a
l.t = d
l.r = n
l.s = g
assert m.s.u.o.z.x.t.o.z.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: J = None
        self.x: E = None
        self.t: G = None
        self.q: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: J = None
        self.w: C = None
        self.x: A = None
        self.z: C = None
        self.t: A = None
        self.y: F = None
        self.q: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: E = None
        self.r: I = None
        self.x: J = None
        self.t: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.z: H = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: G = None
        self.v: I = None
        self.o: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: H = None
        self.z: I = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: D = None
        self.x: I = None
        self.s: F = None
        self.txt = txt

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

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

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

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