class A:
    def __init__(self, txt: str):
        self.r: H = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.y: F = None
        self.p: E = None
        self.o: E = None
        self.s: B = None
        self.x: D = None
        self.q: D = None
        self.z: I = None
        self.r: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.v: I = None
        self.p: C = None
        self.y: C = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

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

n = A("n")
h = B("h")
a = C("a")
i = D("i")
j = E("j")
g = F("g")
d = G("d")
c = H("c")
b = I("b")

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

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

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.y: F = None
        self.p: E = None
        self.o: E = None
        self.s: B = None
        self.x: D = None
        self.q: D = None
        self.z: I = None
        self.r: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.v: I = None
        self.p: C = None
        self.y: C = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

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

n = A("n")
h = B("h")
a = C("a")
i = D("i")
j = E("j")
g = F("g")
d = G("d")
c = H("c")
b = I("b")

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