(0) Obligation:

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

f(0, 1, x) → f(g(x), g(x), x)
f(g(x), y, z) → g(f(x, y, z))
f(x, g(y), z) → g(f(x, y, z))
f(x, y, g(z)) → g(f(x, y, z))

Q is empty.