#include <iostream>
#include <cmath>
using namespace std;

int main(int argc, char** argv) {
	int a, b, x, y;
	cin >> a >> b >> x >> y;
	bool u1 = a==x;
	bool u2 = b==y;
	if(u1&&u2) cout << "nijedan" << endl;
	else
	{
		if(u1) cout << "drugi" << endl;
		if(u2) cout << "prvi" << endl;
	}
	if(!u1 && !u2) cout << "?" << endl;
	return 0;
}