class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.o: D = None
        self.x: E = None
        self.w: J = None
        self.v: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.w: B = None
        self.o: I = None
        self.s: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: D = None
        self.r: E = None
        self.x: D = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.x: B = None
        self.o: C = None
        self.w: F = None
        self.s: F = None
        self.q: E = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.z: I = None
        self.u: E = None
        self.w: B = None
        self.r: I = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.w: B = None
        self.o: I = None
        self.s: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: D = None
        self.r: E = None
        self.x: D = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.x: B = None
        self.o: C = None
        self.w: F = None
        self.s: F = None
        self.q: E = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.z: I = None
        self.u: E = None
        self.w: B = None
        self.r: I = None
        self.txt = txt

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

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