(0) Obligation:

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

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

Q is empty.