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

namespace Spojler
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int a = int.Parse(s[0]);
            int b = int.Parse(s[1]);
            s = Console.ReadLine().Split();
            int x = int.Parse(s[0]);
            int y = int.Parse(s[1]);
            int u = a - x;
            int v = b - y;
            if (u > 0 && v == 0)
                Console.WriteLine("prvi");
            else if (v > 0 && u == 0)
                Console.WriteLine("drugi");
            else if (u == 0 && v == 0)
                Console.WriteLine("nijedan");
            else
                Console.WriteLine("?");
        }
    }
}