Milly and equal array

3.9

748 votes
Ready, Mathematics, Easy-Medium, Number Theory
Problem

Milly is playing with a Array A of size N. She wants to make all the values of A to be equal. She can multiply any value any number of times by X, Y and Z. Your task is to tell her whether she can do it or not. Print "She can" if she can do it else print "She can't" without "".

Input

  • First line of the input will contain T (No. of test cases).
  • For each test case, first line will contain four space separated integers denoting N, X, Y and Z. Then next line will contain N space separated integers of A

Output

  • For every test case, print the required answer in a new line.

Constraints

  • 1 ≤ T ≤ 5
  • 2 ≤ N ≤ 105
  • X, Y, Z ∈ {2, 3, 5, 7}
  • 1 ≤ Ai ≤ 109

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Test case #1: Multiply first value by 2.
Test case #2: Not possible.

Editor Image

?