#include <iostream>
using namespace std;
int main() {
    int a, b, x, y;
    cin >> a >> b >> x >> y;
    if (a == x) {
        if (b == x) {
            cout << "nijedan" << endl;
        }
        else {
            cout << "drugi" << endl;
        }
    }
    else {
        if (b == x) {
            cout << "prvi" << endl;
        }
        else {
            cout << "?" << endl;
        }
    }
}