#include <iostream>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int a;
    int b;
    int x;
    int y;

    cin >> a;
    cin >> b;
    cin >> x;
    cin >> y;

    if (a == x && b!=y) cout << "drugi";
    else if(a != x && b==y)cout << "prvi";
    else if(a == x && b==y)cout << "nijedan";
    else cout << "?";

    return 0;



}