class A:
    def __init__(self, txt: str):
        self.q: I = None
        self.z: H = None
        self.y: B = None
        self.r: H = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.w: G = None
        self.t: F = None
        self.y: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: I = None
        self.s: G = None
        self.x: G = None
        self.y: G = None
        self.t: F = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: F = None
        self.w: J = None
        self.x: I = None
        self.r: F = None
        self.t: J = None
        self.txt = txt

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

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

class J:
    def __init__(self, txt: str):
        self.z: F = None
        self.y: A = None
        self.v: A = None
        self.o: I = None
        self.q: A = None
        self.x: I = None
        self.u: D = None
        self.txt = txt

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

a.q = g
a.z = c
a.r = c
a.y = m
m.t = e
m.x = g
m.o = c
b.p = a
b.w = d
b.t = j
b.y = j
e.v = g
e.s = d
e.x = d
e.y = d
e.t = j
l.v = b
l.p = b
l.q = d
l.u = d
l.o = d
l.r = a
l.t = a
l.z = j
l.w = j
j.x = l
d.p = m
d.q = j
d.r = j
d.w = n
d.t = n
d.x = g
c.q = m
c.o = m
c.x = b
c.t = n
c.s = n
c.r = g
c.p = g
c.y = a
g.r = b
g.z = l
n.z = j
n.y = a
n.v = a
n.q = a
n.o = g
n.x = g
n.u = e
assert n.o.z.r.q.z.t.q.z.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: I = None
        self.z: H = None
        self.y: B = None
        self.r: H = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.w: G = None
        self.t: F = None
        self.y: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: I = None
        self.s: G = None
        self.x: G = None
        self.y: G = None
        self.t: F = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: F = None
        self.w: J = None
        self.x: I = None
        self.r: F = None
        self.t: J = None
        self.txt = txt

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

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

class J:
    def __init__(self, txt: str):
        self.z: F = None
        self.y: A = None
        self.v: A = None
        self.o: I = None
        self.q: A = None
        self.x: I = None
        self.u: D = None
        self.txt = txt

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

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