#include <iostream>

using namespace std;

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