class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: E = None
        self.y: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: G = None
        self.y: J = None
        self.o: J = None
        self.v: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.q: D = None
        self.y: G = None
        self.u: B = None
        self.o: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: A = None
        self.z: E = None
        self.q: H = None
        self.u: H = None
        self.x: H = None
        self.s: I = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: E = None
        self.o: E = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.p: G = None
        self.y: J = None
        self.o: J = None
        self.v: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.q: D = None
        self.y: G = None
        self.u: B = None
        self.o: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: A = None
        self.z: E = None
        self.q: H = None
        self.u: H = None
        self.x: H = None
        self.s: I = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: E = None
        self.o: E = None
        self.txt = txt

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

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

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

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