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

namespace ConsoleApp37
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int a = int.Parse(s.Split(' ')[0]);
            int b = int.Parse(s.Split(' ')[1]);
            s = Console.ReadLine();
            int x = int.Parse(s.Split(' ')[0]);
            int y = int.Parse(s.Split(' ')[1]);
            if (a == x && b == y) Console.WriteLine("nijedan");
            else if (a > x && b == y) Console.WriteLine("prvi");
            else if (a == x && b > y) Console.WriteLine("drugi");
            else if (a>x && b>y) Console.WriteLine("?");
            
        }
    }
}