#include <iostream>

using namespace std;

int main()
{
int a,b,x,y;
cin>>a>>b;
cin>>x>>y;
if(a==x&&b==y)
cout<<"nijedan";
else if(a==x)
cout<<"drugi"<<endl;
else if(b==y)
cout<<"prvi"<<endl;
else if(a==0 && b==0)
cout<<"\nnijedan";
else if(x<y)
cout<<"drugi"<<endl;
else 
cout<<"prvi"<<endl;
    return 0;
}