#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    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;
}