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

namespace Golovi
{
    internal class Program
    {   
        static void provera(int a, int b,int x, int y)
        {
            if (x < a && y==b)
            {
                Console.WriteLine("prvi");
            }
            else if (y < b && x==a)
            {
                Console.WriteLine("drugi");
            }
            else if (x == a && y == b )
            {
                Console.WriteLine("nijedan");
            }
            else
                Console.WriteLine("?");
        }
        static void Main(string[] args)
        {
            string[] red = Console.ReadLine().Split(' ');
            int a = int.Parse(red[0]);
            int b= int.Parse(red[1]);
            red = Console.ReadLine().Split(' ');
            int x = int.Parse(red[0]);
            int y= int.Parse(red[1]);
            provera(a, b, x, y);

        }
    }
}