#include <iostream>

using namespace std;

int main()
{
    int a, b; //vegeredmeny
    cin>>a>>b;
    int x, y;
    cin>>x>>y;

    if(x==a && y==b)
        cout<<"nijedan";
    else if (x==a)
        cout<<"drugi";
    else if (y==b)
        cout<<"prvi";
    else
        cout<<"?";

    return 0;
}