(0) Obligation:

Q restricted rewrite system:
The TRS R consists of the following rules:

f(x, g(x)) → x
f(x, h(y)) → f(h(x), y)

Q is empty.