#include <bits/stdc++.h>

using namespace std;

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