using System;


namespace _2_1
{
    class Program
    {

        public static void Ulaz(ref int i1,ref int i2)
        {
            string input;
            string[] input2;

            input = Console.ReadLine();
            input2 = input.Split(' ');

            i1= int.Parse(input2[0]);
            i2= int.Parse(input2[1]);
        }

        static void Main(string[] args)
        {
            int a, b, x, y;

            a = 0; b=0; x=0; y=0;

            Ulaz(ref a, ref b);
            Ulaz(ref x, ref y);

            if (a == x && b == y)
            {
                Console.WriteLine("nijedan");
            }
            else if (a != x && b != y)
            {
                Console.WriteLine("?");
            }
            else if(a != x && b == y)
            {
                Console.WriteLine("prvi");
            }
            else if (a == x && b != y){ 
                Console.WriteLine("drugi");
            }
        }
    }
}