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

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

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

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: G = None
        self.q: G = None
        self.y: D = None
        self.p: I = None
        self.w: H = None
        self.o: A = None
        self.u: D = None
        self.s: B = None
        self.x: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.x: D = None
        self.q: B = None
        self.w: H = None
        self.u: C = None
        self.v: F = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: C = None
        self.y: A = None
        self.x: C = None
        self.q: B = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.u: D = None
        self.o: H = None
        self.r: G = None
        self.x: A = None
        self.txt = txt

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

i.u = f
i.q = f
i.v = c
i.y = d
i.o = m
i.p = h
f.r = i
f.v = n
f.s = n
f.w = j
c.u = h
c.o = j
c.z = i
c.w = i
c.y = g
c.t = g
c.p = f
c.r = f
c.v = m
n.u = g
h.q = g
h.s = i
m.t = f
m.s = f
m.r = g
m.q = g
m.y = n
m.u = n
m.p = e
m.w = d
m.x = d
m.o = i
g.z = h
g.x = n
g.q = f
g.w = d
g.u = c
g.v = m
d.p = g
d.z = g
d.y = e
e.v = f
e.q = f
e.s = c
e.x = c
e.y = i
j.u = n
j.o = d
j.r = g
j.x = i
assert d.y.q.w.u.u.q.r.o.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.v: C = None
        self.q: B = None
        self.y: H = None
        self.o: F = None
        self.p: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: G = None
        self.q: G = None
        self.y: D = None
        self.p: I = None
        self.w: H = None
        self.o: A = None
        self.u: D = None
        self.s: B = None
        self.x: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.x: D = None
        self.q: B = None
        self.w: H = None
        self.u: C = None
        self.v: F = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: C = None
        self.y: A = None
        self.x: C = None
        self.q: B = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.u: D = None
        self.o: H = None
        self.r: G = None
        self.x: A = None
        self.txt = txt

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

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