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

namespace ConsoleApplication35
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] r = Console.ReadLine().Split(' ');
            long a = long.Parse(r[0]);
            long b = long.Parse(r[1]);
            
            string[] s = Console.ReadLine().Split(' ');
            long x = long.Parse(s[0]);
            long y = long.Parse(s[1]);

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