#include <bits/stdc++.h>
using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	
	int a, b;
	cin >> a >> b;
	
	int x, y;
	cin >> x >> y;
	
	if(a != x && b == y)
	{
		cout << "prvi";
		return 0; 
	}
	
	if(a == x && b != y)
	{
		cout << "drugi";
		return 0;
	}
		
	if(a == x && b == y)
	{
		cout << "nijedan";
		return 0;
	}
	
	if(a != x && b != y)
	{
		cout << "?";
		return 0;
	}
}