using System;
using System.Collections.Generic;
using System.ComponentModel.Design.Serialization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace spojler
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string jed = Console.ReadLine();
            string dva = Console.ReadLine();
            int a = int.Parse(jed.Split()[0]);
            int b = int.Parse(jed.Split()[1]);
            int x = int.Parse(dva.Split()[0]);
            int y = int.Parse(dva.Split()[1]);
            if (x >= a && y >= b) Console.WriteLine("nijedan");
            else if (Math.Abs(x - a) > 0 && Math.Abs(y - b) > 0) Console.WriteLine("?");
            else if (x == a && b - y > 0) Console.WriteLine("drugi");
            else if (b==y&&a-x > 0) Console.WriteLine("prvi");
            Console.ReadLine();
        }
    }
}