using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int a = int.Parse(s[0]);
            int b = int.Parse(s[1]);

            string[] s1 = Console.ReadLine().Split();
            int x = int.Parse(s1[0]);
            int y = int.Parse(s1[1]);

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