#include <iostream>
#include "testlib.h"

using namespace std;
const int N=200;
int n, res[N][2], place[N][2], p[N][2];
bool outOfRange(int x)
{
    return (x<1) || (x>400);
}
bool check(int& cnt)
{
    cnt=0;
    for(int i=0; i<n; ++i)
    {
        if(outOfRange(res[i][0]) || outOfRange(res[i][1])) return false;
        for(int j=i+1; j<n; ++j)
            for(int k=0; k<2; ++k)
            {
                if(res[i][k]==res[j][k])
                {
                    printf("Participants %d and %d in the %d tour have equal points\n", i+1, j+1, k+1);
                    return false;
                }
                if((place[i][k]>place[j][k])&&(res[i][k]>res[j][k]))
                {
                    printf("Participants %d and %d in the tour %d are not in the required order\n", i+1, j+1, k+1);
                    return false;
                }
            }
        if(res[i][0]+res[i][1]>res[0][0]+res[0][1]) cnt++;
    }
    return true;
}
int main(int argc, char * argv[])
{
    registerTestlibCmd(argc, argv);
    n=inf.readInt(); int req=inf.readInt(); req--;
    for(int j=0; j<2; ++j)
        for(int i=0; i<n; ++i)
        {
            int x=inf.readInt();
            x--, p[i][j]=x;
            place[x][j]=i;
        }
    int p1, p2;
    string str=ans.readLine();
    if(str.compare("Possible")==0)
    {
        for(int j=0; j<2; ++j)
            for(int i=0; i<n; ++i)
                res[p[i][j]][j]=ans.readInt();
        if(!check(p1)) quitf(_fail, "Invalid answer");
        if(p1!=req) quitf(_fail, "Invalid answer");
    }
    string oustr=ouf.readLine();
    if(oustr.compare("Impossible")==0)
        if(str.compare("Possible")==0)
            quitf(_wa, "Contestant thinks that the solution does not exist");
        else
            quitf(_ok, "Impossible");
    for(int j=0; j<2; ++j)
        for(int i=0; i<n; ++i)
            res[p[i][j]][j]=ouf.readInt();
    if(!check(p2)) quitf(_pe, "Invalid output");
    if(p2!=req) quitf(_pe, "Invalid output");
    if(str.compare("Impossible")==0) quitf(_fail, "Contestant found the solution, but jury did not");
    quitf(_ok, "ok");
    return 0;
}
