using System;

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