#include <bits/stdc++.h>
using namespace std;
#define endl "\n"


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int a, b, x, y;
    cin >> a >> b >> x >> y;
    if(a == x){
        if(b == y)
            cout << "nijedan" << endl;
        else
            cout << "drugi" << endl;
    }
    else{
        if(b == y){
            cout << "prvi" << endl;
        }
        else{
            cout << "?" << endl;
        }
    }

}