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

namespace Spojler
{
    internal class Program
    {
        static void Main(string[] args)
        {
            int a, b, x, y;
            string[] str1 = Console.ReadLine().Split();
            string[] str2 = Console.ReadLine().Split();
            a = Convert.ToInt32(str1[0]);
            b = Convert.ToInt32(str1[1]);
            x = Convert.ToInt32(str2[0]);
            y = Convert.ToInt32(str2[1]);
            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("nijedan");
            else if (a > x && b > y)
                Console.WriteLine("?");
        }
    }
}