using System;

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


        }
    }
}