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

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