#include<bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    int a, b; cin>>a>>b;
    int a1, b1; cin>>a1>>b1;

    if(a1<a && b==b1)
        cout<<"prvi";
    if(a==a1 && b1<b)
        cout<<"drugi";
    if(a1<a && b1<b)
        cout<<"?";
    if(a==a1 && b==b1)
        cout<<"nijedan";

    return 0;   }