class A:
    def __init__(self, txt: str):
        self.y: G = None
        self.v: H = None
        self.q: G = None
        self.p: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: F = None
        self.p: E = None
        self.z: A = None
        self.r: C = None
        self.s: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.q: B = None
        self.w: F = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.p: F = None
        self.y: B = None
        self.r: D = None
        self.x: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: E = None
        self.o: B = None
        self.r: G = None
        self.p: F = None
        self.w: G = None
        self.s: B = None
        self.u: G = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.u: F = None
        self.p: E = None
        self.z: A = None
        self.r: C = None
        self.s: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.q: B = None
        self.w: F = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.p: F = None
        self.y: B = None
        self.r: D = None
        self.x: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: E = None
        self.o: B = None
        self.r: G = None
        self.p: F = None
        self.w: G = None
        self.s: B = None
        self.u: G = None
        self.txt = txt

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

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