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

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