#P3150. Even-Odd Splitting Game

    ID: 16408 Type: Default 1000ms 256MiB

Even-Odd Splitting Game

Even-Odd Splitting Game

A game is played as follows:

  • The game starts with a given positive integer.
  • In each move, the current player splits the number into two positive integers whose sum equals the original number.
  • Then, the opponent chooses one of the two numbers to continue the game.
  • The players alternate taking turns. The game ends when a player is presented with the number 1, which cannot be split into two positive integers. The player unable to make a move loses, and the other wins.

In every game, player pb makes the first splitting move. Both players are assumed to play optimally, meaning they choose moves that maximize their chances of eventually winning.

Analysis: It can be deduced that the winning condition depends solely on the parity of the initial number. In fact, when the initial number is even, there exists a partition (specifically, splitting it as 1 and n-1) that forces both resulting numbers to yield a losing position for the opponent. Therefore, pb wins when the number is even; otherwise, pb does not have a winning strategy, and zs wins.

Your task is to determine the winner for each game. If the starting number of a game is even, output pb wins; if odd, output zs wins.

inputFormat

The first line contains an integer T (1 ≤ T ≤ 105), representing the number of games. Each of the following T lines contains a single integer N (1 ≤ N ≤ 109) which denotes the initial number for that game.

outputFormat

For each game, output a single line. Print pb wins if player pb has a winning strategy when starting with N (i.e. when N is even); otherwise, print zs wins.

sample

3
2
3
6
pb wins

zs wins pb wins

</p>