#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;
    if(x != a && b == y)cout << "prvi";
    else if(x == a && b!=y)cout << "drugi";
    else if(x == a && b == y)cout << "nijedan";
    else cout << "?";
}