Homomorphism in each coordinate implies cocycle for trivial group action

Statement
Suppose $$G$$ is a group and $$A$$ is an abelian group. Suppose $$f:G^n \to A$$ is a function with the property that, for all $$i \in \{ 1,2,\dots,n \}$$, if we fix the entries in all coordinates but the $$i^{th}$$ coordinate, the induced function from $$G$$ to $$A$$ is a homomorphism of groups.

Then, $$f$$ is a $$n$$-cocycle for trivial group action.