#include <bits/stdc++.h>
using namespace std;
int a,b,c,d;
int main(){
  scanf("%d %d %d %d",&a,&b,&c,&d);
  if(a==c and b==d){printf("nijedan");return 0;}
  if(a==c and b!=d){printf("drugi");return 0;}
  if(a!=c and b==d){printf("prvi");return 0;}
  printf("?");
  return 0;
}