using System;

namespace ConsoleApp1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            int a, b, x, y;
            string[] red = Console.ReadLine().Split(' ');
            a = int.Parse(red[0]);
            b = int.Parse(red[1]);
            red = Console.ReadLine().Split(' ');
            x = int.Parse(red[0]);
            y = int.Parse(red[1]);
            if (a == x && b == y)
                Console.WriteLine("nijedan");
            else if (a != x && b != y)
                Console.WriteLine("?");
            else
                Console.WriteLine(a - x > 0 ? "prvi" : "drugi");
            Console.ReadLine();
        }
    }
}