#include <iostream>
#define ll long long
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	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 << "?";
	}
}