#include <iostream>
using namespace std;
int main()
{
    long long a,b,c,d;
    cin >> a  >> b >> c >> d;
    if(a==c){
        if(b==d){cout << "nijedan";}
        if(b!=d){cout <<"drugi";}
    }
    else{
        if(b!=d){cout<<"?";}
        if(b==d){cout <<"prvi";}}
}