All Tracks Problem

Milly and equal array
Tag(s):

Easy-Medium, Math, Number Theory

Problem
Editorial
Analytics

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

SAMPLE INPUT
2
2 2 2 2
2 4
3 2 3 2
2 6 7
SAMPLE OUTPUT
She can
She can't
Explanation

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

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Visual Basic, Kotlin

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

Notifications
View All Notifications