#include <iostream>

using namespace std;

int main()
{
    int a,b,c,d;
    cin >> a >> b;
    cin >> c >> d;
    if(a==c && b==d){
        cout << "nijedan" << endl;
    }
    else if(a==c){
        cout << "drugi" << endl;
    }
    else if(b==d){
        cout << "prvi" << endl;
    }
    else{
        cout << "?" << endl;
    }
    return 0;
}