using System;

namespace Takmicenje_petlja_2
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var inputLine2 = Console.ReadLine();
            var inputLine1 = Console.ReadLine();
            string[] temp1 = new string[2];
            temp1 = inputLine1.Split();
            string[] temp2 = new string[2];
            temp2 = inputLine2.Split();
            int[] halftimeRez = new int[2];
            int[] finalRez = new int[2];
            halftimeRez[0] = int.Parse(temp1[0]);
            halftimeRez[1] = int.Parse(temp1[1]);
            finalRez[0] = int.Parse(temp2[0]);
            finalRez[1] = int.Parse(temp2[1]);

            if (finalRez[0] > halftimeRez[0] && finalRez[1] > halftimeRez[1])
            {
                Console.Write("?");
            }
            else if(finalRez[0] > halftimeRez[0] && finalRez[1] == halftimeRez[1])
            {
                Console.WriteLine("prvi");
            }
            else if(finalRez[0] == halftimeRez[0] && finalRez[1] > halftimeRez[1])
            {
                Console.WriteLine("drugi");
            }
            else
            {
                Console.WriteLine("nijedan");
            }
        }
    }
}