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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, x, y;
            string red = Console.ReadLine();
            string[] delovi = red.Split(' ');
            a = int.Parse(delovi[0]);
            b = int.Parse(delovi[1]);
            string red1 = Console.ReadLine();
            string[] delovi1 = red1.Split(' ');
            x = int.Parse(delovi1[0]);
            y = int.Parse(delovi1[1]);
            if (a == x && b == y)
                Console.WriteLine("nijedan");
            else if (a == x && b != y)
                Console.WriteLine("drugi");
            else if (a != x && b == y)
                Console.WriteLine("prvi");
            else
                Console.WriteLine("?");

        }
    }
}