#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    int a, b, x, y;
    cin >> a >> b;
    cin >> x >> y;
    a == x ? b == y ? cout << "nijedan" << endl : cout << "drugi" << endl : b == y ? cout << "prvi" << endl : cout << "?" << endl;
    return 0;
}