#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {
	int a, b;
	int x, y;
	cin >> a >> b;
	cin >> x >> y;
	if (x == a && y == b){
		cout << "nijedan";
	}
	else if (x == a && y != b){
		cout << "drugi";
	}
	else if (x != a && y == b){
		cout << "prvi";
	}
	else  if( x != a && y != b){
		cout << "?";
	}
}