class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: I = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: A = None
        self.w: E = None
        self.v: D = None
        self.t: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: I = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: A = None
        self.w: E = None
        self.v: D = None
        self.t: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

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

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

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