#include <bits/stdc++.h>
#include "testlib.h"

using namespace std;

struct Meeting {
    int a;
    int b;
    int t;

    bool operator < (const Meeting& other) const {
        return t < other.t;
    }
};

int n, d;
vector<Meeting> m;

inline int readAndCheckAnswer(InStream& in) {
    int read_a = in.readInt() - 1;
    int read_b = in.readInt() - 1;
    int read_t = in.readInt();

    int id = -1;
    for (int i = 0; i < d; ++i) {
        if (m[i].a == read_a && m[i].b == read_b && m[i].t == read_t) {
            id = i;
            break;
        }
    }

    if (id == -1) {
        return -1;
    }

    vector<char> u(n);
    u[0] = 1;

    for (int i = 0; i < d; ++i) {
        if (i == id) continue;
        int r = u[m[i].a] | u[m[i].b];
        u[m[i].a] = u[m[i].b] = r;
    }

    int result = 0;
    for (int j = 0; j < n; ++j) {
        result += u[j];
    }

    return result;
}

int main(int argc, char* argv[]) {
    registerTestlibCmd(argc, argv);

    n = inf.readInt();
    d = inf.readInt();

    for (int i = 0; i < d; i++) {
        int _a = inf.readInt() - 1;
        int _b = inf.readInt() - 1;
        int _t = inf.readInt();
        m.push_back({_a, _b, _t});
    }

    sort(m.begin(), m.end());

    int ja = readAndCheckAnswer(ans);
    if (ja == -1) {
        quitf(_fail, "Jury prevented non-existent meeting");
    }

    int pa = readAndCheckAnswer(ouf);
    if (pa == -1) {
        quitf(_wa, "Participant prevented non-existent meeting");
    }

    if (ja < pa) {
        quitf(_wa, "Jury found better answer than participant");
    }
    if (pa < ja) {
        quitf(_fail, "Participant found better answer than jury");
    }

    quitf(_ok, "OK");
}
