#include <iostream>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int a,b;
    cin >> a >> b;
    int x,y;
    cin >> x >> y;
    
    a-=x;
    b-=y;
    
    if(a == 0 && b > 0)
        cout << "drugi\n";
    else if(b == 0 && a > 0)
        cout << "prvi\n";
    else if(a == b)
        cout << "nijedan\n";
    else cout << "?\n";
    return 0;
}