#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <sstream>
 
using namespace std;
int main() 
{
   int a,b,c,d;
   cin >> a >> b;
   cin >> c >> d;
   if (a>c && b > d)
   {
      cout << "?";
   }
   else if (a>c && b== d)
   {
      cout<< "prvi";
   }
   else if (a==c && b>d)
   {
      cout << "drugi";
   }
   else
   {
      cout<<"nijedan";
   }
}