#include<bits/stdc++.h>
using namespace std;
 
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int a1, b1, a2, b2;
    cin >> a1 >> a2
        >> b1 >> b2;
    if(a1 == b1 && a2 == b2){
        cout << "nijedan" << "\n";
    }
    else if(a1 == b1){
        cout << "drugi" << "\n";
    }
    else if(a2 == b2){
        cout << "prvi" << "\n";
    }
    else{
        cout << "?" << "\n";
    }
}