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

namespace Takmicenje
{
    internal class Program
    {
        static void ucitaj(out int a,out int b)
        {
            a = 0;
            b = 0;
            string s = Console.ReadLine();
            int i;
            for (i = 0; s[i] != ' '; i++)
            {
                a = a * 10 +s[i];
            }
            i++;
            for (; i < s.Length; i++)
            {
                b = b * 10 + s[i];
            }
        }
        static void Main(string[] args)
        {
            int a, b, y, x;
            ucitaj(out a, out b);
            ucitaj(out x, out y);
            if (a == x && b == y)
            {
                Console.WriteLine("nijedan");
            }
            else if (a>x && b==y)
            {
                Console.WriteLine("prvi");
            }
            else if (a == x && b>y)
            {
                Console.WriteLine("drugi");
            }
            else
            {
                Console.WriteLine("?");
            }
        }
    }
}