using System;

namespace Spojler
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = Convert.ToInt32(input[0]);
            int b = Convert.ToInt32(input[1]);
            input = Console.ReadLine().Split(" ");
            int x = Convert.ToInt32(input[0]);
            int y = Convert.ToInt32(input[1]);
            if (a != x)
            {
                if (b != y) Console.WriteLine("?");
                else Console.WriteLine("prvi");
            }
            else if (b != y) Console.WriteLine("drugi");
            else Console.WriteLine("nijedan");
        }
    }
}