#include <iostream>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
	int a, b, x, y;
	cin>>a>>b>>x>>y;
	if(x==a and y!=b){
		cout << "drugi" << '\n';
	}if(y==b and x!=a){
		cout << "prvi" << '\n';
	}if(y==b and x==a){
		cout << "nijedan" << '\n';
	}if(y!=b and x!=a){
		cout << "?" << '\n';
	}
}