Under construction

Still being built. Things may change

Card Swap

Interview

Time limit0.3sMemory limit256 MB

Summary
Given two multisets of n cards, each a color letter plus a digit, decide whether they are identical or differ in at least one card.
Level

Easy2 of 10

Topics
Hash map, Implementation, Sorting, Array
Solved
No attempts yet

Problem

Orca and Dolphin enjoy playing card games. Each card is painted in one of red (R), yellow (Y), or blue (B), and has a digit from 0 to 9 written on it. There may be multiple cards with the same color and digit.

Orca has lost every game recently, and has grown suspicious that Dolphin secretly swaps cards.

Orca has an excellent memory, so he remembers all n cards before the card game and all n cards the two played during the card game. However, he lacks the ability to judge whether Dolphin swapped a card.

For example, suppose that before the card game there were n = 5 cards, as follows.

  • R0
  • B9
  • R5
  • Y3
  • R2

After the card game ends, the cards Orca remembers are as follows.

  • R0
  • B8
  • R5
  • Y3
  • R2

In this case, Dolphin swapped the B9 card for a B8 card.

Write a program that judges whether there is evidence that Dolphin swapped a card.

Input

The first line gives the number of test cases T.

Each test case consists of three lines, as follows.

The first line gives the number of cards n.

The second line gives n strings, separated by spaces, representing the n cards Orca remembers before the card game. Each string is two characters long: the first character is one of R, Y, B, and the second character is one of the digits 0-9.

The third line gives the n cards Orca remembers after the card game ends. The input format is the same as the second line.

Output

For each test case, print one line: "CHEATER" without quotes if Dolphin swapped a card, or "NOT CHEATER" without quotes otherwise.

Constraints

  • 1 ≤ T ≤ 10
  • 1 ≤ n ≤ 200

Examples1

  1. Example 1

    Input
    4
    5
    R0 B9 R5 Y3 R2
    R0 B8 R6 Y3 R2
    1
    R0
    R0
    3
    R1 R0 R0
    R0 R1 R1
    3
    R1 R1 R0
    R0 R1 R1
    
    Expected output
    CHEATER
    NOT CHEATER
    CHEATER
    NOT CHEATER