#include <iostream>
using namespace std;

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