Casino Strategy
You have received magical eyeglasses from a gambling genie that will reveal the expected value of different games at any moment. To make the most of this gift, you enter a grand casino. There are some amount of games available, and your glasses give you visions about the expected value of these games — the amount of money you're likely to win if you play it.
These visions could be about games you've never seen before, or they could be a change in the expected value of games.
You've devised a strategy to use, where you will always play a game the first time you see its value, and otherwise, you will only play it if the value has gone up since last time you saw its expected value. You must decide whether to play or skip the game each time you receive a vision.
Input
The first line contains an integer , the number of visions you will receive about the expected values of different games.
The next lines each contain the name of the game
and the expected value of the game,
. The game
is a string with a length between
and
characters inclusive, containing only alphanumeric characters.
Output
For each vision, output either "Play" or "Skip" followed by the name of the game. You should only play the game if you have never seen that game's value before, or if this value is strictly greater than its value the last time you saw it.
Examples
Input 1
6
Blackjack 10
Poker 5
Poker 3
Roulette 8
Slots 12
Blackjack 11
Output 1
Play Blackjack
Play Poker
Skip Poker
Play Roulette
Play Slots
Play Blackjack
Initially you play both Blackjack and Poker, as you haven't seen their values before. Then, you skip Poker as its value has gone down from to
. Next, you haven't seen Roulette before, so you play it. Same with Slots. Finally, Blackjack has a value of
, and last time you saw it it was
, so you play it.
Input 2
5
Poker 5
Darts 6
Poker 5
Darts 4
Poker 6
Output 2
Play Poker
Play Darts
Skip Poker
Skip Darts
Play Poker
We initially play both Poker and Darts as we haven't seen them before. Then, we need strictly greater value, so we skip both Poker and Darts. Finally, Poker goes from to
, so we play it.
Input 3
3
Blackjack 10
Blackjack 3
Blackjack 5
Output 3
Play Blackjack
Skip Blackjack
Play Blackjack
We play the first Blackjack game as we haven't seen it prior, then skip the next one as it is less than the previously seen value of . In the third Blackjack game, we do play it since
is greater than the previously seen value of
.
Comments