#include <iostream>
using namespace std;

int main() {
  int x,y,a,b;
  cin>>a>>b;
  cin>>x>>y;

  if(x==a && y==b)
    cout<<"nijedan\n";
  else if(x==a)
    cout<<"drugi\n";
  else if(y==b)
    cout<<"prvi\n";
  else
    cout<<"?\n";
}