condition 1: (5+2)^4n mod 5 similar to 2^4n mod 5, similar to (5-1)^2n mod 5, similar to (-1)^2n mod 5, similar to 1^n mod 5, so, question can be solved.
condition 2: (5+2)^3n mod 5 similar to 2^3n mod 5, similar to 8^n mod 5, similar to (5+3)^n mod 5, similar to 3^n mod 5, so, question cannt be solved.