#include <iostream>
using namespace std;

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