Problem with Church numerals evaluation
Function application is not associative. It may seem at first that this is valid because function composition is associative, but according to Wikipedia,


  Bracketing may be used and may be needed to disambiguate terms. For example, ${\lambda x.((\lambda x.x)x)}$ and ${(\lambda x.(\lambda x.x))x}$ denote different terms (although they coincidentally reduce to the same value). Here the first example defines a function that defines a function and returns the result of applying $x$ to the child-function (apply function then return), while the second example defines a function that returns a function for any input and then returns it on application of $x$ (return function then apply).


$\lambda f.\lambda x.((ff)f)x$ is a distinct lambda term from $\lambda f.\lambda x.(f(ff))x$.