#include <bits/stdc++.h>

#include "testlib.h"

using namespace std;

const int MaxN = 1e5 + 15;
const int MOD = 1e9 + 7;

int L[MaxN], R[MaxN];
int n;
int answer;

pair<int, int> l, r;

int main(int argc, char* argv[])
{
    registerTestlibCmd(argc, argv);
    n = inf.readInt();
    ++n;
    
    for(int i = 1; i <= n; ++i)
    {
        L[i] = inf.readInt();
        R[i] = inf.readInt();
    }
    answer = ouf.readInt();

    l = make_pair(0, 0);
    r = make_pair(MOD, 0);

    for(int i = 1; i <= n; ++i)
        if(i != answer)
        {
            l = max(l, make_pair(L[i], i));
            r = min(r, make_pair(R[i], i));
        }

    if(l.first > r.first)
        quitf(_wa, "segments %d and %d are not intersect", l.second, r.second);
    quitf(_ok, "OK");

    return 0;
}
