(0) Obligation:

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

g(c, g(c, x)) → g(e, g(d, x))
g(d, g(d, x)) → g(c, g(e, x))
g(e, g(e, x)) → g(d, g(c, x))
f(g(x, y)) → g(y, g(f(f(x)), a))
g(x, g(y, g(x, y))) → g(a, g(x, g(y, b)))

Q is empty.