We show that two finitely generated finite-by-nilpotent groups are elementarily equivalent if and only if they satisfy the same sentences with two alternations of quantifiers. For each integer n ≥ 2, we prove the same result for the following classes of structures:
(1) the (n + 2)-tuples (A1, …, An+1, f), where A1, …, An+1 are disjoint finitely generated Abelian groups and f: A1 × … × An → An+1 is a n-linear map;
(2) the triples (A, B, f), where A, B are disjoint finitely generated Abelian groups and f: An → B is a n-linear map;
(3) the pairs (A, f), where A is a finitely generated Abelian group and f: An → A is a n-linear map.
In the proof, we use some properties of commutative rings associated to multilinear maps.