#include<bits/stdc++.h>
using namespace std;
int a,b,c,d;
int main(){
    cin>>a>>b>>c>>d;
    if(a==c&&b==d)
        cout<<"nijedan";
    else if(a==c)
        cout<<"drugi";
    else if(b==d)
        cout<<"prvi";
    else
        cout<<"?";
    cout<<endl;
    return 0;
}