#include <iostream>

using namespace std;

int main()
{
    int a,b,x,y;
    cin >> a >> b >> x >> y;
    
    if(a>x){
        if(b==y) {cout << "prvi"; return 0;}
        else {cout << "?"; return 0;}
    }
    
    if(b>y){
        if(a==x) cout << "drugi";
        else cout << "?";
    }
    else cout << "nijedan";
    
    return 0;
}