#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long a,b,c,d;
    
    cin>>a>>b;
    cin>>c>>d;
    
    if (a==c and b==d) cout<<"nijedan"<<endl;
    else if (a==c and b>d) cout<<"drugi"<<endl;
    else if (a>c and b==d) cout<<"prvi"<<endl;
    else if (a>c and b>d) cout<<"?"<<endl;
}