% query: f(f,f,f)
f(X,Y,Z):-g(X,Y,Z).
g(0,1,X):-f(X,X,X).