#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int a, b;
	cin >> a >> b;
	int x, y;
	cin >> x >> y;
	if(x == y and a == b and x == a and x == b and y == a and y == b)
	cout << "nijedan";
	else if(a == x and b > y)
	cout << "drugi";
	else if(b == y and a > x)
	cout << "prvi";
	else 
	cout << "?";
	return 0;
}