#include <iostream>

using namespace std;

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

    if(a > x) cout << "-1" << endl;
    else if (b > y) cout << "-1" << endl;
    else if(a < x && b == y) cout << "prvi" << endl;
    else if(a == x && b < y) cout << "drugi" << endl;
    else if(a < x && b < y) cout << "?" << endl;
    else if(a==x && b==y) cout << "nijedan" << endl;
    else cout << "-1" << endl;
    return 0;
}