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

namespace Takmicenje_3___1__Predvidjen_rezultat_
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int a = Convert.ToInt32(s[0]);
            int b = Convert.ToInt32(s[1]);
            s = Console.ReadLine().Split();
            int x = Convert.ToInt32(s[0]);
            int y = Convert.ToInt32(s[1]);
            if (x == a)
            {
                if (y < b) Console.WriteLine("drugi");
                else
                    Console.WriteLine("nijedan");
            }
            else if(y == b)
            {
                Console.WriteLine("prvi");
            }
            else
                Console.WriteLine("?");
        }
    }
}