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