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

namespace Zadatak1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            long x, y, a, b;

            string[] s = Console.ReadLine().Split();
            a = int.Parse(s[0]);
            b = int.Parse(s[1]);

            s = Console.ReadLine().Split();
            x = int.Parse(s[0]);
            y = int.Parse(s[1]);

            if (a > x && b > y) Console.WriteLine("?");
            else if (a > x && b == y) Console.WriteLine("prvi");
            else if (a == x && b > y) Console.WriteLine("drugi");
            else Console.WriteLine("nijedan");
        }
    }
}