#include <iostream>
using namespace std;
int main() {
    cin.tie(NULL);
    ios::sync_with_stdio(false);
    pair<int, int> a, b;
    cin >> a.first >> a.second >> b.first >> b.second;
    if (a.first == b.first) {
        if (a.second == b.second) cout << "nijedan";
        else cout << "drugi";
    }
    else if (a.second == b.second) {
        if (a.first == b.first) cout << "nijedan";
        else cout << "prvi";
    }
    else cout << "?";
    return 0;
}