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

namespace Takmicenje2
{
    class Program
    {
        static void Main(string[] args)
        {
            string t = Console.ReadLine();
            int a = int.Parse(t.Split(' ')[0]);
            int b = int.Parse(t.Split(' ')[1]);
            t = Console.ReadLine();
            int x = int.Parse(t.Split(' ')[0]);
            int y = int.Parse(t.Split(' ')[1]);


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

        }
    }
}