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