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