class A:
    def __init__(self, txt: str):
        self.o: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: G = None
        self.t: H = None
        self.s: J = None
        self.x: A = None
        self.o: H = None
        self.z: C = None
        self.w: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: H = None
        self.q: B = None
        self.y: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: H = None
        self.w: H = None
        self.r: B = None
        self.v: C = None
        self.y: I = None
        self.p: J = None
        self.x: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.s: C = None
        self.w: D = None
        self.p: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: B = None
        self.z: H = None
        self.t: I = None
        self.v: D = None
        self.y: D = None
        self.u: J = None
        self.p: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: I = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.u: E = None
        self.x: J = None
        self.y: J = None
        self.s: E = None
        self.q: A = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: F = None
        self.q: F = None
        self.o: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.v: G = None
        self.t: H = None
        self.s: J = None
        self.x: A = None
        self.o: H = None
        self.z: C = None
        self.w: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: H = None
        self.q: B = None
        self.y: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: H = None
        self.w: H = None
        self.r: B = None
        self.v: C = None
        self.y: I = None
        self.p: J = None
        self.x: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.s: C = None
        self.w: D = None
        self.p: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: B = None
        self.z: H = None
        self.t: I = None
        self.v: D = None
        self.y: D = None
        self.u: J = None
        self.p: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: I = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.u: E = None
        self.x: J = None
        self.y: J = None
        self.s: E = None
        self.q: A = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: F = None
        self.q: F = None
        self.o: C = None
        self.txt = txt

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

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