#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(0);
    
    int ps1,ps2,s1,s2;
    cin >> ps1 >> ps2 >> s1 >> s2;
    if(ps1 == s1 && ps2 == s2){
        cout << "nijedan";
    }
    else if(ps1 == s1){
        cout << "drugi";
    }
    else if(ps2 == s2){
        cout << "prvi";
    }
    else cout << "?";
}