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

namespace spojlerator
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            string[] s1 = Console.ReadLine().Split();
            int a1 = int.Parse(s[0]);
            int a2 = int.Parse(s[1]);
            int b1 = int.Parse(s1[0]);
            int b2 = int.Parse(s1[1]);
            if (b1 < a1 && b2 < a2)
            {
                Console.WriteLine("?");
            }
            else if (b1 < a1 && b2 == a2)
            {
                Console.WriteLine("prvi");
            }
            else if (b1 == a1 && b2 < a2)
            {
                Console.WriteLine("drugi");
            }
            else
            {
                Console.WriteLine("nijedan");
            }
        }
    }
}