#include <iostream>

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