#P12079. Flip Card Game

    ID: 14185 Type: Default 1000ms 256MiB

Flip Card Game

Flip Card Game

Petya and Vasya bought a new card game called Flip. The game contains \(n\) double‐sided cards and \(m\) single‐sided cards.

  • Double-sided card. The front side of the card has a number \(a_i\) and the back side has a number \(b_i\).
  • Single-sided card. The front side of the card has a number \(c_i\).

All numbers written on all card faces are distinct. Initially, every card is placed on the table with its front side up. On his turn, a player must choose exactly one of the following actions on the card with the smallest number among all cards currently on the table:

  1. Remove that card from the table.
  2. If the card is a double-sided card and is currently showing its front side, flip it (so that its back side becomes visible). Note that once turned, it cannot be flipped again.

The game ends when the last card is removed; the player who removes the last card wins. Determine the winner if Petya goes first and both players play optimally.

inputFormat

The first line contains two integers \(n\) and \(m\) \( (0 \le n, m \le 10)\), representing the number of double‐sided and single‐sided cards respectively.

The next \(n\) lines each contain two distinct integers \(a_i\) and \(b_i\), representing the numbers on the front and back of a double‐sided card.

The next \(m\) lines each contain a single integer \(c_i\), representing the number on a single‐sided card. It is guaranteed that all numbers on all cards (both sides) are distinct.

outputFormat

Output a single line: Petya if Petya wins when both players play optimally; otherwise, output Vasya.

sample

0 1
5
Petya

</p>