#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<<"nijedan"<<endl;
    else if(x==a)
    cout<<"drugi"<<endl;
    else if(y==b)
    cout<<"prvi"<<endl;
    else 
    cout<<"?"<<endl;
    return 0;
}