using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

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