#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int a,b;
    cin>>a>>b;
    int x,y;
    cin>>x>>y;
    if(b==y&&x<a){
        cout<<"prvi"<<endl;
    }
    else if(a==x&&y<b){
        cout<<"drugi"<<endl;
    }

    else if(a==x&&b==y){
        cout<<"nijedan"<<endl;
    }
    else{
        cout<<"?"<<endl;
    }
    return 0;
}