#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a, b, x, y;
    
    cin >> a >> b;
    cin >> x >> y;
    
    if(a==x && b==y) {printf("nijedan"); return 0;}
    else if(a==x) {printf("drugi"); return 0;}
    else if(b==y){printf("prvi"); return 0;}
    else {printf("?"); return 0;}

    

    return 0;
}