class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: E = None
        self.s: B = None
        self.r: F = None
        self.u: E = None
        self.x: D = None
        self.y: E = None
        self.v: H = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: H = None
        self.y: D = None
        self.t: G = None
        self.p: H = None
        self.q: A = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: A = None
        self.r: H = None
        self.p: E = None
        self.s: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: F = None
        self.x: G = None
        self.v: F = None
        self.r: I = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.q: B = None
        self.z: G = None
        self.t: E = None
        self.s: G = None
        self.p: B = None
        self.w: E = None
        self.u: G = None
        self.x: E = None
        self.txt = txt

k = A("k")
l = B("l")
i = C("i")
e = D("e")
d = E("d")
a = F("a")
g = G("g")
j = H("j")
m = I("m")

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

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

class C:
    def __init__(self, txt: str):
        self.z: H = None
        self.y: D = None
        self.t: G = None
        self.p: H = None
        self.q: A = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: A = None
        self.r: H = None
        self.p: E = None
        self.s: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: F = None
        self.x: G = None
        self.v: F = None
        self.r: I = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.q: B = None
        self.z: G = None
        self.t: E = None
        self.s: G = None
        self.p: B = None
        self.w: E = None
        self.u: G = None
        self.x: E = None
        self.txt = txt

k = A("k")
l = B("l")
i = C("i")
e = D("e")
d = E("d")
a = F("a")
g = G("g")
j = H("j")
m = I("m")

k.p = i
k.t = d
k.u = d
k.y = d
k.s = l
k.r = a
k.x = e
k.v = j
l.t = i
l.q = m
i.z = j
i.p = j
i.y = e
i.t = g
i.q = k
e.q = d
d.t = i
d.z = e
d.v = a
a.x = i
a.w = m
g.x = l
g.q = k
g.r = j
g.p = d
g.s = d
j.p = a
j.v = a
j.x = g
j.r = m
m.q = l
m.p = l
m.z = g
m.s = g
m.u = g
m.t = d
m.w = d
m.x = d
assert j.r.s.r.v.w.w.v.w.z.txt == "g"