#include <iostream>
using namespace std;
int main()
{
    int n, m, i, j;
    cin >> n >> m;
    cin >> i >> j;
    if (i > n && m == j)
        cout << "prvi";
    else if (j > m && i == n)
        cout << "drugi";
    else if (i == n && j == m)
        cout << "nijedan";
    else
        cout << "?";
}