#include <iostream>

using namespace std;
typedef unsigned long long ull;
int main()
{
    ull a,b,x,y;
    cin>>a>>b;
    cin>>x>>y;
    if(a==x && b==y){cout<<"nijedan";}
    else if(a==x && b!=y){cout<<"drugi";}
    else if(a!=x && b==y){cout<<"prvi";}
    else{cout<<"?";}
    return 0;
}