#include <iostream>

using namespace std;

int main(){
	int x, y, a, b, c = 0;
	cin >> x >> y >> a >> b;
	if (x == a) c += 1;
	if (y == b) c += 2;
	if (c == 0){
		cout << "?";
	}else if (c == 1){
		cout << "drugi";
	}else if (c == 2){
		cout << "prvi";
	} else cout << "nijedan";
}