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();
            long a1 = long.Parse(s[0]);
            long a2 = long.Parse(s[1]);
            long b1 = long.Parse(s1[0]);
            long b2 = long.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");
            }
        }
    }
}