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

namespace ConsoleApp3
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string xy = Console.ReadLine();
            string ab = Console.ReadLine();
            
            string[] xy1 = xy.Split(' ');
            string[] ab1 = ab.Split(' ');

            int a1 = int.Parse(ab1[0]);
            int b1 = int.Parse(ab1[1]);
            int x1 = int.Parse(xy1[0]);
            int y1 = int.Parse(xy1[1]); 



            if (a1 < x1 && b1 == y1)
            {
                Console.WriteLine("prvi");
            }
            else if (a1 == x1 && b1 < y1)
            {
                Console.WriteLine("drugi");
            }
            else if (x1 == a1 && y1 == b1)
            {
                Console.WriteLine("nijedan");
            }
            else if (a1 < x1 && b1 < y1)
            {
                Console.WriteLine("?");
            }


            Console.ReadLine();

        }
    }
}