#include <iostream>

using namespace std;

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

        if (x==a && y==b)
        {
            cout << "nijedan";
            return 0;
        }
        else
            cout << "?";
    return 0;
}