#include <bits/stdc++.h>

using namespace std;

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