G. MicrosoftHearts
time limit per test
2 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output

Microsoft Hearts is a classical game of Microsoft Windows. Let's look at Microsoft Hearts of 2 players.

Each player has $$$n$$$ cards initially. There is one of the four suits on one single card: H-Heart$$$\heartsuit$$$, S-Spade$$$\spadesuit$$$, D-Diamond$$$\diamondsuit$$$, C-Club$$$\clubsuit$$$.

The cards are ranked by the point on it. The smallest is 2, and the greatest is A, in which A stands for 14, T stands for 10, i.e. 2<3<4<5<6<7<8<9<T<J<Q<K<A.

The game has following rules.

Each round, the player who has the token would put one of his/her card out. Then the other player can play as following restrictions.

  1. If the player has a card of the same suit of the card of the previous player, he/she must put a card of the same suit of the previous card out. The player who put out the card with greater rank can take the two cards to his/her scoring area, and get the token, that is, to play first in the next round.
  2. If not, he/she can put any card in hand. However, without considering the rank, the previous player can take the two cards to his/her scoring area. And the token stays still.

At the end, when players put all 13 cards out, a player's score is the number of HEART cards of his/her scoring area. The player with minor score wins. If the scores are the same, Alice wins.

Additional, we don't consider the "Shoot the Moon" of Spade$$$\spadesuit$$$ Q. Just follow the rules above.

Now, Alice and Bob are playing a Microsoft Hearts of 2 players. Both of them know the cards of each other. At the beginning, Alice has the token to put the card out first.

Alice wants to know, if both of them play the game optimally for themselves, whether she will win the game. Output "Yes" or "No".

Input

The first line contains a single positive integer $$$n\ (n\le 13)$$$, denoting the number of cards of one player.

The following two lines, each line contains $$$n$$$ strings, denoting Alice's and Bob's cards, respectively. The string contains the rank and the suit. For example "7H" stands for $$$\heartsuit7$$$, "TS" stands for $$$\spadesuit10$$$.

Output

Print one single line.

If Alice wins, print "Yes". Otherwise, print "No".

Example
Input
3
AH JH 7S
3H TD 5H
Output
No