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:

  lexicographic path order with precedence:
  
    precedence:
    
      f > h > |0| > g > f#
    
    argument filter:
  
      pi(f#) = 1
      pi(f) = [1]
      pi(g) = [2]
      pi(h) = []
      pi(|0|) = []

The next rules are strictly ordered:

  p1, p2

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