#include <bits/stdc++.h>
using namespace std;

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

    return 0;
}