#include <iostream>

using namespace std;

int main() {
	int a, b, c, d;
	cin>>a>>b>>c>>d;
	bool _a = a == c;
	bool _b = b == d;
	
	if(_a && _b) cout<<"nijedan";
	else if(_a)  cout<<"drugi";
	else if(_b)  cout<<"prvi";
	else         cout<<"?";
	
	return 0;
}