#include <iostream>

using namespace std;

int main()
{
    long long int a, b, x, y;
    cin >> a >> b;
    cin >> x >> y;

    if(a==x && b==y)
    {
        cout << "nijedan" << endl;
    }
    else if(a==x)
    {
        cout << "drugi" << endl;
    }
    else if(b==y)
    {
        cout << "prvi" << endl;
    }
    else
    {
        cout << "?" << endl;
    }
}