#include <iostream>

using namespace std;

int main()
{
    int a,b;
    cin>>a>>b;
    int x,y;
    cin>>x>>y;
    bool q,w;
    q=a>x;
    w=b>y;
    if(q && w)
    {
        cout<<"?";
    }
    else if(q)
    {
        cout<<"prvi";
    }
    else if(w)
    {
        cout<<"drugi";
    }
    else
    {
        cout<<"nijedan";
    }
    return 0;
}