spoj PROOTS: check if the numbers are primitive roots of a given prime number