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

namespace zad1k2
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] nz = Console.ReadLine().Split();
            int a = int.Parse(nz[0]),b = int.Parse(nz[1]);
            nz = Console.ReadLine().Split();
            int x = int.Parse(nz[0]), y = int.Parse(nz[1]);
            int dg1 = a-x, dg2 = b-y;
            if(dg1==0 && dg2==0)
            {
                Console.WriteLine("nijedan");
            }
            else
            {
                if (dg1 != 0 && dg2 != 0)
                {
                    Console.WriteLine("?");
                }
                else
                {
                    if(dg1==0)
                    {
                        Console.WriteLine("drugi");
                    }
                    else
                    {
                        Console.WriteLine("prvi");
                    }
                }
            }
            Console.ReadLine();
        }
    }
}