#include<iostream>
#include<bits/stdc++.h>

using namespace std;
int main(){
	int a, b;
	cin >> a >> b;
	int x, y; 
	cin >> x >> y;
	
	int resenje = 0;	
	if(a == x && b == y) resenje = 3;
	if(a == x && y < b) resenje = 2;
	if(x < a && b == y) resenje = 1;
	
	if(resenje == 0) cout << "?";
	else if(resenje == 1) cout << "prvi";
	else if(resenje == 2) cout << "drugi";
	else cout << "nijedan";

    return 0;
}