using System;

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

        }
    }
}