All Tracks Problem

Milly and pens
Tag(s):

Data Structures, Easy, Hashing, Implementation

Problem
Editorial
Analytics

Milly and Pranjul together want to buy N unique pens. Each pen has a unique id. Pranjul can buy P pens and Milly can buy M pens at a time. Your task is to print “They can” if they can buy those N unique pens at least one each else print “They can’t”.

Input

  • First line of the input will contain T (No. of test cases).
  • For each test case, first line will contain three space separated integers denoting N, P and M. Then next line will contain P space separated integers denoting the ids of pen that Pranjul can buy and the next line will contain M space separated integers denoting the ids of pen that Milly can buy.

Output

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

Constraints

  • 1 ≤ T ≤ 10
  • 1 ≤ N ≤ 104
  • 1 ≤ P, M ≤ 105
  • 1 ≤ Pen idN
SAMPLE INPUT
2
4 2 2
1 2
3 4
3 2 2
1 2
1 2
SAMPLE OUTPUT
They can
They can't
Explanation

Test case #2: Then can’t buy the pen with id = 3.

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++, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala 2.11.8, Swift, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

Altimetrik

Challenge Name

Altimetrik Java Hiring Challenge

OTHER PROBLEMS OF THIS CHALLENGE
Notifications
View All Notifications