#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
	int a, b;
	cin >> a >> b;
	int x, y;
	cin >> x >> y;
	
	if((a == x) && (b > y))
		cout << "drugi" << endl;
	else if((a > x) && (b == y))
		cout << "prvi" << endl;
	else if((a == x) && (b == y))
		cout << "nijedan" << endl;
	else
		cout << "?" << endl;
	
	
	return 0;
}