using System;

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