#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a, b; // Spojlovani rezultati
    int x, y; // Rezultati na poluvremenu
    int razlika = x-y;
    int zbir1 = a+b;
    int zbir2 = x+y;
    cin >> a >> b >> x >> y;
    if(b == y && x < a){
        cout<<"prvi";
    }else if(a == x && y < b){
        cout<<"drugi";
    }else if(a == b && x == y && b == x && a == y){
        cout<<"nijedan";
    }else if(b > a && y < x){
        cout<<"drugi";
    }else if(b > a && x < y){
        cout<<"?";
    }else if(a == b && zbir1 > zbir2 + 1){
        cout<<"?";
    }
    return 0;
}