P3007 [USACO11JAN] The Continental Cowngress G

Description

Displeased with Farmer John's leadership, the cows have seceded from the farm and have formed the first Continental Cowngress. Built on the principle of 'every cow gets something they want,' they've decided on the following voting system: The M (1

Input Format

\* Line 1: Two space-separated integers: N and M \* Lines 2..M+1: Line i+1 describes cow i's votes with four space-separated fields -- an integer, a vote, another integer, and another vote: B\_i, VB\_i, C\_i, VC\_i

Output Format

\* Line 1: A string with N characters, where the ith character is either a 'Y' if the ith bill must pass, an 'N' if the ith bill must fail, or a '?' if it cannot be determined whether the bill passes from these votes. If there is no solution which satisfies every cow, then output the single line 'IMPOSSIBLE'.