#include <iostream>

int main() {
    unsigned short a, b;
    unsigned short x, y;
    std::cin >> a >> b;
    std::cin >> x >> y;
    if (a != x && b != y) {
        std::cout << "?" << std::endl;
    } else if (a == x && b == y) {
        std::cout << "nijedan" << std::endl;
    } else if (a == x) {
        std::cout << "drugi" << std::endl;
    } else {
        std::cout << "prvi" << std::endl;
    }
    return 0;
}