#include <iostream>

using namespace std;

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (a == c && b == d){
        cout << "nijedan";
    }
    else if (a == c){
        cout << "drugi";
    }
    else if (b == d){
        cout << "prvi";
    }
    else {
        cout << "?";
    }

}