#include <iostream>

using namespace std;

int main()
{
    int x,y,c,z;
    cin>>x>>y>>c>>z;
    if(x==c)
    if(y==z) cout<<"nijedan";
    else cout<<"drugi";
    else if(y==z) cout<<"prvi";
    else cout<<"?";
}