#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    int a, b, as, bs; cin>>a>>b>>as>>bs;
    if(a != as && b == bs)
        cout<<"prvi";
    else if(a==as && b != bs)
        cout<<"drugi";
    else if(a==as && b==bs)
        cout << "nijedan";
    else 
        cout<<"?";
    

    return 0;
}