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

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