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

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.t: A = None
        self.x: A = None
        self.y: H = None
        self.z: E = None
        self.s: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: A = None
        self.w: G = None
        self.txt = txt

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

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

class I:
    def __init__(self, txt: str):
        self.y: F = None
        self.s: B = None
        self.v: D = None
        self.x: E = None
        self.o: B = None
        self.w: H = None
        self.t: A = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.t: A = None
        self.x: A = None
        self.y: H = None
        self.z: E = None
        self.s: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: A = None
        self.w: G = None
        self.txt = txt

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

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

class I:
    def __init__(self, txt: str):
        self.y: F = None
        self.s: B = None
        self.v: D = None
        self.x: E = None
        self.o: B = None
        self.w: H = None
        self.t: A = None
        self.txt = txt

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

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