#include <iostream>

using namespace std;

int main() {
	
	int pk, dk, ps, ds;
	
	cin>>pk>>dk>>ps>>ds;
	
	if (pk-ps==0 and dk-ds!=0)
		cout<<"drugi";
	
	if (pk-ps!=0 and dk-ds==0)
		cout<<"prvi";
	
	if (pk-ps==0 and dk-ds==0)
		cout<<"nijedan";
	
	if (pk-ps!=0 and dk-ds!=0)
		cout<<"?";
	
	return 0;

}