Problem E
A Tricky Problem
The genre of tricktaking card games encompasses many popular games, such as Bridge, Hearts, Euchre, and Briscola. At their core, these games revolve around each player having some number of cards (which may be dealt all at once, or as the game progresses), and a number of rounds (or â€œtricks") where each player plays a card. Based on these cards, and specially on how they each compare to each other, players receive a number of points.
You will write a program to determine the winner of a very simple tricktaking card, defined as follows:

There are only two players.

Each player is given $N$ cards at the start of the game.

The possible cards, from least valuable to most valuable, are:
2, 3, 4, 5, 6, 7, 8, 9, J, Q, K, A
Note that there is no 10 card.

The suit of the card (hearts, diamonds, spades, clubs) is irrelevant.

In each round, each player plays a single card (consequently, a single game is composed of $N$ rounds). The player with the highest card in that round wins a single point. If both players play a card of equal value, no points are given in that round.

At the end of the game, the player with the most points wins. If both players have the same number of points, the result of the game is a tie.
For example, consider the following game:
At the end of this game, Player 1 will be the winner.
Your program will be given the cards that each player played in each round, and you will simply have to determine what player won each round and, finally, determine what player won the game (or if there is a tie).
Input
The input contains three lines with the specification of a single game.
The first line contains a single integer: the value of $N$ ($1 \leqslant N \leqslant 1\, 000$; we assume we have an infinite supply of cards to play with).
The second line represents the cards played by Player 1 and the third line represents the cards played by Player 2. Each of these lines contains $N$ characters, each separated by a single space. Each character represents a single card. The cards are presented in the same order in which they are played.
Output
The output contains a single line with the result of the game. If Player 1 wins, print PLAYER 1 WINS. If Player 2 wins, print PLAYER 2 WINS. If the game ends in a tie, print TIE.
Sample Input 1  Sample Output 1 

5 A 3 J Q 7 5 7 2 K 4 
PLAYER 1 WINS 
Sample Input 2  Sample Output 2 

4 A 3 J Q 5 7 2 K 
TIE 
Sample Input 3  Sample Output 3 

3 2 2 2 A A A 
PLAYER 2 WINS 
Sample Input 4  Sample Output 4 

5 A 3 2 Q 7 5 7 2 K 4 
TIE 