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

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.r: H = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: G = None
        self.y: F = None
        self.q: A = None
        self.u: D = None
        self.o: F = None
        self.t: I = None
        self.w: H = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: H = None
        self.o: C = None
        self.s: H = None
        self.u: G = None
        self.x: I = None
        self.y: E = None
        self.v: C = None
        self.p: H = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.r: H = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: G = None
        self.y: F = None
        self.q: A = None
        self.u: D = None
        self.o: F = None
        self.t: I = None
        self.w: H = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: H = None
        self.o: C = None
        self.s: H = None
        self.u: G = None
        self.x: I = None
        self.y: E = None
        self.v: C = None
        self.p: H = None
        self.txt = txt

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

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

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