#include<bits/stdc++.h>

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== b && c ==d){
        cout<<"?"<<endl;

    }
    else if(a== b && c !=d && d!=b && a!=d){
        cout<<"?"<<endl;

    }
    else if(a==c && b!=d){
        cout<<"drugi"<<endl;
    }
    else if(b==d && b!=0 && d!=0 && a!=c){
        cout<<"prvi"<<endl;
    }
    else if(a != b && c==d){
        cout<<"?"<<endl;
    }
    else if(a > c && b == d && b!=0 && d!=0){
        cout<<"?"<<endl;
    }
    else if(a > c && b==0 && d ==0){
        cout<<"prvi"<<endl;

    }
    else if(a == 0 & c == 0 && b>d){
        cout<<"drugi"<<endl;
    }
    else if(a > c && b > d){
        cout<<"?"<<endl;
    }
    else if(a != c && b!=d){
        cout<<"?"<<endl;
    }

    

   





    return 0;
}