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

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