using System;
using System.Threading;

namespace ConsoleApp1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] ab = Console.ReadLine().Split();
            int a = int.Parse(ab[0]);
            int b = int.Parse(ab[1]);
            string[] abs = Console.ReadLine().Split();
            int aa = int.Parse(abs[0]);
            int bb = int.Parse(abs[1]);
            if (bb == b && aa < a)
            {
                Console.WriteLine("prvi");
            }
            else if (aa == a && bb < b)
            {
                Console.WriteLine("drugi");
            }
            else if (aa == a && bb == b)
            {
                Console.WriteLine("nijedan");
            }
            else
            {
                Console.WriteLine("?");
            }
        }
    }
}