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

namespace takmicenje_kvalifikacije_2
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] ulaz = Console.ReadLine().Split();
            int a = Convert.ToInt32(ulaz[0]);
            int b = Convert.ToInt32(ulaz[1]);

            ulaz = Console.ReadLine().Split();
            int x = Convert.ToInt32(ulaz[0]);
            int y = Convert.ToInt32(ulaz[1]);

            if (x == a && y == b) Console.WriteLine("nijedan");
            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("?");
        }
    }
}