using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp27
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] rec = Console.ReadLine().Split();
            int a = int.Parse(rec[0]);
            int b = int.Parse(rec[1]);
            rec = Console.ReadLine().Split();
            int x = int.Parse(rec[0]);
            int y = int.Parse(rec[1]);
            if (x == a && y == b) Console.WriteLine("nijedan");
            else if (b==y) Console.WriteLine("prvi");
            else if (a==x) Console.WriteLine("drugi");
            else Console.WriteLine("?");
        }
    }
}