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

namespace takprog2
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] predvidjanje = Console.ReadLine().Split();
            int a = int.Parse(predvidjanje[0]);
            int b = int.Parse(predvidjanje[1]);
            string[] poluvreme = Console.ReadLine().Split();
            int x = int.Parse(poluvreme[0]);
            int y = int.Parse(poluvreme[1]);

            if(a >= 0 && a <= 100 && b >= 0 && b <= 100)
            {
                if(x >= 0 && x <= a && y >= 0 && y <= b)
                {
                    if (x == a && y == b)
                        Console.WriteLine("nijedan");
                    else if (x == a && y < b)
                        Console.WriteLine("drugi");
                    else if (x < a && y == b)
                        Console.WriteLine("prvi");
                    else if (x < a && y < b)
                        Console.WriteLine('?');
                }
            }
        }
    }
}