ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

## 1374. Misere

Time limit: 1.0 second
Memory limit: 16 MB
Naked man walks along the streed. Policeman stops him ans asks:
"Are you alright? Why naked?"
Man answers with a question:
"Listen, does a misere ever gets spoiled by 7, 9 and J?"
Policeman: "Never!"
Man: "And I thought so…"
It is six o'clock. Morning. Or night. Kitchen. Four students play a game of preference. Or do not play. Indeed, they do not play. But why? What happened? What are they busy with? Oh… They dispute about something. Oh, got it!
One of them bid a misere contract. And believes that he will not get any trick. But other players are trying to convince him of being wrong. Their voices are already hoarse. They even opened all the cards! Made discarded cards known! But nothing helps…
Then one of them tells:
— Aren't we students of Mathematical and mechanical department? Let's write a program, which will look over all possible plays and justify us.
Nobody objected. But because of they were bad students or maybe due to sleepless night the program was never written… Will you help them?
Oh, you need to know some basic facts about preference. Precisely, you only need to know rules of playing a misere.
Preference is played with 32 cards: the Ace (A), King (K), Queen (Q), Jack (J), 10, 9, 8 and 7s (in the order of decreasing rank) from a standard 4-suit 52-card deck. Suits are usual: Spades, Clubs, Diamonds and Hearts. Preference is played by three players sitting at the round table (in fact, the shape of the table does not matter; the only important thing is that each player has right and left neighbour and that players are numbered clockwise).
After cards are dealt, bidding takes place. We omit bidding rules here, they are not important for this problem. One of the possible result of bidding is a misere contract. It means, that player will try to win no tricks with his cards.
After the bidding each player has 10 cards. So 10 tricks are played. Each trick is played in the following way. The player, who leads the first trick, puts any of his cards on the table face up. Then his left neighbour puts his card. Then remaining player puts his card.
Each player must follow the suit of the first card in a trick, if possible. Otherwise, he may discard any card from his hand. The player, who put the card of the highest rank with a suit of the first card in a trick, wins that trick. The player who wins a trick leads the next trick.
Successfull playing of the misere contract gives a big profit to the player. But each won trick gives a great loss. Now you know the actual reason for the dispute!
Your task is to justify the students. Given cards of each player and a number of the player, who leads the first trick, you are to determine, whether the first player, who declared the misere contract, is able to play the declared contract regardless of the other players' strategy.

### Input

Each of the first three lines of the input contain cards of the corresponding player. Each card is described with two characters: a suit (one of the S, C, D or H) and a rank (one of the 7, 8, 9, 10, J, Q, K or A). Card descriptions are separated with space(s). The fourth line contains the number of the player, who leads the first trick.

### Output

Output should contain exactly one line. In case when the misere contract can be played successfully regardless of the strategy of other players, this line should contain ";)". Otherwise it should contain ";(".

### Sample

inputoutput
7S 8S 9S 10S JS QS KS AS 7C 8C
9C 10C JC QC KC AC 7D 8D 9D 10D
JD QD KD AD 7H 8H 9H 10H JH QH
1
;)
Problem Author: Den Raskovalov
Problem Source: IX Urals Programming Contest. Yekaterinburg, April 19-24, 2005