Milly and equal array
Practice
3.9 (748 votes)
Ready
Mathematics
Easy Medium
Number theory
Problem
46% Success 7951 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

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

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
9 votes
Tags:
MathematicsEasy-Medium
Points:20
131 votes
Tags:
Ad-HocBasic ProgrammingEasy
Points:30
2 votes
Tags:
Ad-HocReadyAlgorithmsApprovedEasy-Medium