using System;
namespace ConsoleApp28
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, x, y;
            string s = Console.ReadLine();
            a = Int32.Parse(s.Split(" ")[0]);
            b = Int32.Parse(s.Split(" ")[1]);
            string s1 = Console.ReadLine();
            x = Int32.Parse(s1.Split(" ")[0]);
            y = Int32.Parse(s1.Split(" ")[1]);
            a -= x;
            b -= y;
            if (a == 0 && b == 0)
            {
                Console.WriteLine("nijedan");
            }
            else if (b == 0)
            {
                Console.WriteLine("prvi");
            }
            else if (a == 0)
            {
                Console.WriteLine("drugi");
            }
            else
            {
                Console.WriteLine("?");
            }
        }
    }
}