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

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: C = None
        self.t: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.t: C = None
        self.txt = txt

n = A("n")
h = B("h")
f = C("f")
i = C("i")
g = B("g")
a = A("a")
e = B("e")
d = B("d")

n.s = h
n.y = h
n.u = a
h.s = i
h.u = i
h.t = f
f.z = a
f.t = i
i.z = a
i.t = f
g.s = f
g.t = f
g.u = i
a.s = g
a.u = n
a.y = h
e.s = f
e.u = f
e.t = f
d.s = f
d.t = f
d.u = i
assert i.t.z.y.s.t.t.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.u: A = None
        self.y: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: C = None
        self.t: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.t: C = None
        self.txt = txt

n = A("n")
h = B("h")
f = C("f")
i = C("i")
g = B("g")
a = A("a")
e = B("e")
d = B("d")

n.s = h
n.y = h
n.u = a
h.s = i
h.u = i
h.t = f
f.z = a
f.t = i
i.z = a
i.t = f
g.s = f
g.t = f
g.u = i
a.s = g
a.u = n
a.y = h
e.s = f
e.u = f
e.t = f
d.s = f
d.t = f
d.u = i
assert i.t.z.y.s.t.t.t.z.txt == "a"