#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll f1,f2,t1,t2;
int main(){
   cin>>f1>>f2>>t1>>t2;
   if(f1==t1 and f2==t2){
      cout<<"nijedan\n";
      return 0;
   }
   if(f1==t1){
      cout<<"drugi\n";
      return 0;
   }
   if(f2==t2){
      cout<<"prvi\n";
      return 0;
   }
   cout<<"?\n";
   return 0;
}