Under construction

Still being built. Things may change

Prime Game

Time limit2sMemory limit256 MB

Summary
Simulate a two-player game where each spoken prime is recorded per player, duplicates cost 1000 points, and a non-prime gives the opponent their third largest prime or 1000.
Level

Medium4 of 10

Topics
Simulation, Implementation, Number theory, Sorting
Solved
No attempts yet

Problem

Daewoong, a student at Inha University, loves number theory. At some point he started memorizing primes, and now he can tell whether any number he hears is prime. When a rumor spread that Inha University has a god of primes, Gyuseong, the prime master of Insang University, challenged Daewoong.

The two decided to bet on who loves primes more. Since there is no way to measure that directly, they settle it with the prime game.

The rules of the prime game are as follows.

  1. The two players take turns saying one number each.
  2. When a player says a number that is not prime, the opponent gains points. The opponent gains the third largest of the primes the opponent has said so far. If the opponent has said fewer than 3 primes so far, the opponent gains 1000 points instead.
  3. If a player says a prime that has already appeared at least once, that player gets −1000-1000 points, and the prime is not recorded as one of that player's primes.
  4. Gyuseong is the challenger, so Daewoong always moves first.
  5. Every number the players say is less than 5 000 0005\,000\,000.

0 and 1 are not prime. Both players start with 0 points. Print the winner of the prime game played under these rules.

Input

The first line contains NN, the number of rounds. (5≤N≤100 0005 \le N \le 100\,000)

Each of the next NN lines contains the integers said by Daewoong and Gyuseong in that round, in this order, separated by a space. In each round Daewoong speaks first and Gyuseong speaks second. Every integer is at least 00 and less than 5 000 0005\,000\,000.

Output

After all rounds, the player with the higher score wins. Print 소수의 신 갓대웅 if Daewoong wins and 소수 마스터 갓규성 if Gyuseong wins. If the scores are equal, print 우열을 가릴 수 없음. Print these Korean strings exactly as shown.

Examples1

  1. Example 1

    Input
    5
    2 3
    4 9
    2 10
    7 37
    11 3
    
    Expected output
    소수의 신 갓대웅