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

class B:
    def __init__(self, txt: str):
        self.t: I = None
        self.z: C = None
        self.x: F = None
        self.r: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.v: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.w: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: I = None
        self.p: C = None
        self.t: B = None
        self.z: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: I = None
        self.q: A = None
        self.o: C = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: I = None
        self.z: C = None
        self.x: F = None
        self.r: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.v: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.w: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: I = None
        self.p: C = None
        self.t: B = None
        self.z: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: I = None
        self.q: A = None
        self.o: C = None
        self.txt = txt

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

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

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

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

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