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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int p = int.Parse(s[0]), d = int.Parse(s[1]);
            s = Console.ReadLine().Split();
            int a = int.Parse(s[0]), b = int.Parse(s[1]);
            if (a == p && b == d)
            {
                Console.WriteLine("nijedan");
            }
            else if (a < p && b < d)
            {
                Console.WriteLine("?");
            }
            else if (b == d)
            {
                Console.WriteLine("prvi");   
            }
            else
            {
                Console.WriteLine("drugi");
            }
        }
    }
}