#include <bits/stdc++.h>
using namespace std;
int main(){
int b1,b2,b3,b4;
cin >> b1;
cin >> b2;
cin >> b3;
cin >> b4;
if(b4<b2 && b3>=b1){
cout << "drugi" << endl;
}
else if(b4>=b2 && b3<b1){
cout << "prvi" << endl;
}
else if(b4>=b2 && b3>=b1){
cout << "nijedan" << endl;
}
else cout << '?' << endl;
}