3570.Game with Powers

Time Limit: 1s Memory Limit: 256MB

Vasya and Petya wrote down all integers from 1 to n to play the "powers" game (n can be quite large; however, Vasya and Petya are not confused by this fact).

Players choose numbers in turn (Vasya chooses first). If some number x is chosen at the current turn, it is forbidden to choose x or all of its other positive integer powers (that is, x2, x3, ...) at the next turns. For instance, if the number 9 is chosen at the first turn, one cannot choose 9 or 81 later, while it is still allowed to choose 3 or 27. The one who cannot make a move loses.

Who wins if both Vasya and Petya play optimally?

Input Format(From the terminal/stdin)

Input contains single integer n (1 \le n \le 109).

Output Format(To the terminal/stdout)

Print the name of the winner - "Vasya" or "Petya" (without quotes).

Sample Input 1

Copy
1
 \n

Sample Output 1

Copy
Vasya
     \n

Sample Input 2

Copy
2
 \n

Sample Output 2

Copy
Petya
     \n

Sample Input 3

Copy
8
 \n

Sample Output 3

Copy
Petya
     \n

Hints

In the first sample Vasya will choose 1 and win immediately.

In the second sample no matter which number Vasya chooses during his first turn, Petya can choose the remaining number and win.

Submit

请先 登录

© 2025 FAQs