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

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