#include <iostream>
using namespace std;
int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 int a,b,x,y;
 cin>> a >>b >> x >> y;
 if(a!=x && b==y){
     cout<<"prvi";
 }else if(a==x && b!=y){
     cout<<"drugi";
 }else if(a==x && b==y){
     cout<<"nijedan"
 }else if(a!=x && b!=y){
     cout<<"?";
 }
    return 0;
}