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

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

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

n = A("n")
f = B("f")
h = C("h")
i = C("i")
g = A("g")
e = B("e")
c = B("c")
j = B("j")

n.t = g
n.w = e
n.u = j
f.w = j
f.s = n
f.t = h
h.s = n
h.v = i
i.s = n
i.v = h
g.t = n
g.w = e
g.u = c
e.w = j
e.s = n
e.t = i
c.w = j
c.s = n
c.t = h
j.w = c
j.s = g
j.t = h
assert g.u.s.w.s.u.w.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.w: B = None
        self.u: B = None
        self.txt = txt

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

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

n = A("n")
f = B("f")
h = C("h")
i = C("i")
g = A("g")
e = B("e")
c = B("c")
j = B("j")

n.t = g
n.w = e
n.u = j
f.w = j
f.s = n
f.t = h
h.s = n
h.v = i
i.s = n
i.v = h
g.t = n
g.w = e
g.u = c
e.w = j
e.s = n
e.t = i
c.w = j
c.s = n
c.t = h
j.w = c
j.s = g
j.t = h
assert g.u.s.w.s.u.w.w.s.txt == "g"