#include <iostream>



using namespace std;

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