#include <iostream>

using namespace std;

int main() {
    int a, b, x, y;
    cin >> a >> b >> x >> y;
    if (x == a && y == b) {
        cout << "nijedan\n";
    } else if (x == a) {
        cout << "drugi\n";
    } else if (y == b) {
        cout << "prvi\n";
    } else {
        cout << "?\n";
    }
    return 0;
}