시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 (추가 시간 없음) 1024 MB26121248.000%

문제

A new two-player game simulates two countries fighting over a territory. This territory contains a number of strategic positions which are suitable for setting up war camps. The players take turns setting up a camp at one of these spots.

In this territory, there are also a number of trails that connect two positions each. Whenever a player sets up a new camp, this player will send a small group of soldiers over every adjacent trail that leads to an enemy encampment. Each of these groups of soldiers will raid the enemy camp. In other words, for every trail, the second player to capture one of the incident positions can launch at most one raid over this trail. When every strategic position has been claimed, the game ends. The player that performed the most raids wins the game.

Assuming both players play optimally, who wins?

입력

The input consists of:

  • One line containing two integers $n$ ($1 \leq n \leq 20$), the number of strategic positions, and $m$ ($0 \leq m \leq \frac{n(n-1)}{2}$), the number of trails.
  • $m$ lines, each containing two integers $a$ and $b$ ($1 \leq a, b \leq n$, $a\neq b$), indicating that there is a trail between position $a$ and position $b$.

There is at most one trail between every pair of strategic positions.

출력

If the player who goes first wins, output "player 1". If the player who goes second wins, output "player 2". If the players tie, output "tie".

예제 입력 1

3 3
1 2
2 3
1 3

예제 출력 1

tie

예제 입력 2

2 1
1 2

예제 출력 2

player 2

예제 입력 3

5 7
3 4
2 1
4 5
1 4
1 3
2 3
2 4

예제 출력 3

player 1

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2021 Preliminaries E번

  • 문제를 만든 사람: Reinier Schmiermann