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