YES

We show the termination of the TRS R:

  f(f(x)) -> f(g(f(x),x))
  f(f(x)) -> f(h(f(x),f(x)))
  g(x,y) -> y
  h(x,x) -> g(x,|0|())

-- SCC decomposition.

Consider the dependency pair problem (P, R), where P consists of

p1: f#(f(x)) -> f#(g(f(x),x))
p2: f#(f(x)) -> g#(f(x),x)
p3: f#(f(x)) -> f#(h(f(x),f(x)))
p4: f#(f(x)) -> h#(f(x),f(x))
p5: h#(x,x) -> g#(x,|0|())

and R consists of:

r1: f(f(x)) -> f(g(f(x),x))
r2: f(f(x)) -> f(h(f(x),f(x)))
r3: g(x,y) -> y
r4: h(x,x) -> g(x,|0|())

The estimated dependency graph contains the following SCCs:

  {p1, p3}


-- Reduction pair.

Consider the dependency pair problem (P, R), where P consists of

p1: f#(f(x)) -> f#(g(f(x),x))
p2: f#(f(x)) -> f#(h(f(x),f(x)))

and R consists of:

r1: f(f(x)) -> f(g(f(x),x))
r2: f(f(x)) -> f(h(f(x),f(x)))
r3: g(x,y) -> y
r4: h(x,x) -> g(x,|0|())

The set of usable rules consists of

  r1, r2, r3, r4

Take the reduction pair:

  matrix interpretations:
  
    carrier: N^2
    order: lexicographic order
    interpretations:
      f#_A(x1) = x1
      f_A(x1) = ((1,0),(1,0)) x1 + (4,3)
      g_A(x1,x2) = x2 + (1,2)
      h_A(x1,x2) = (3,1)
      |0|_A() = (1,1)

The next rules are strictly ordered:

  p1, p2

We remove them from the problem.  Then no dependency pair remains.