#include <stdio.h>
#include <math.h>
#include <iostream>

using namespace std;

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