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

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

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

        }
    }
}