#include<bits/stdc++.h>

using namespace std;

int spojl1, spojl2;
int real1, real2;

int main() {
	cin >> spojl1 >> spojl2 >> real1 >> real2;
	if(spojl1 == real1) {
		if(spojl2 == real2) {
			cout << "nijedan";
			return 0;
		}
		else {
			cout << "drugi";
			return 0;
		}
	}
	else {
		if(spojl2 == real2) {
			cout << "prvi";
			return 0;
		}
		else {
			cout << "?";
			return 0;
		}
	}
}