YES

We show the termination of the TRS R:

  f(f(X)) -> f(g(f(g(f(X)))))
  f(g(f(X))) -> f(g(X))

-- SCC decomposition.

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

p1: f#(f(X)) -> f#(g(f(g(f(X)))))
p2: f#(f(X)) -> f#(g(f(X)))
p3: f#(g(f(X))) -> f#(g(X))

and R consists of:

r1: f(f(X)) -> f(g(f(g(f(X)))))
r2: f(g(f(X))) -> f(g(X))

The estimated dependency graph contains the following SCCs:

  {p3}


-- Reduction pair.

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

p1: f#(g(f(X))) -> f#(g(X))

and R consists of:

r1: f(f(X)) -> f(g(f(g(f(X)))))
r2: f(g(f(X))) -> f(g(X))

The set of usable rules consists of

  (no rules)

Take the monotone reduction pair:

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

The next rules are strictly ordered:

  p1
  r1, r2

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