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

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.x: I = None
        self.v: A = None
        self.r: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.z: D = None
        self.q: B = None
        self.txt = txt

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

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

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

class I:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: G = None
        self.o: D = None
        self.q: D = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.z: B = None
        self.q: E = None
        self.x: F = None
        self.txt = txt

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

l.p = m
f.o = n
f.s = m
f.p = j
f.v = l
f.w = h
g.z = m
g.u = h
j.t = g
j.x = b
j.v = l
j.r = k
e.v = n
e.z = j
e.q = f
n.t = g
n.v = b
k.z = n
k.o = j
k.t = m
k.r = b
m.x = f
b.p = g
b.s = k
b.o = j
b.q = j
h.z = f
h.q = e
h.x = n
assert g.u.q.z.v.p.x.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: H = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.x: I = None
        self.v: A = None
        self.r: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.z: D = None
        self.q: B = None
        self.txt = txt

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

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

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

class I:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: G = None
        self.o: D = None
        self.q: D = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.z: B = None
        self.q: E = None
        self.x: F = None
        self.txt = txt

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

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