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

namespace ConsoleApp17
{
    internal class Program
    {
        static string Predvidjanje(int a, int b, int x, int y)
        {
            if (a == x && b == y)
                return "nijedan";
            else
            {
                if(a == x)
                {
                    return "drugi";
                }
                else if(b == y)
                {
                    return "prvi";
                }
                else
                {
                    return "?";
                }


            }
        }
        static bool ValidanUlaz(int a, int b, int x, int y)
        {
            if(a >= 0 && a <= 100 && b >= 0 && b <= 100 && x >= 0 && x <= a && y >= 0 && y <= b)
                return true;
            return false;
        }
        static void Main(string[] args)
        {
            string[] kraj = Console.ReadLine().Split();
            int a = int.Parse(kraj[0]);
            int b = int.Parse(kraj[1]);

            string[] poluvreme = Console.ReadLine().Split();
            int x = int.Parse(poluvreme[0]);
            int y = int.Parse(poluvreme[1]);
            
            if(ValidanUlaz(a, b ,x , y))
                Console.WriteLine(Predvidjanje(a, b, x, y));
        }
    }
}