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

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