using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
    static void Main(string[] args)
    {
        int[] ab = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int[] xy = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        if (ab[0] == xy[0])
        {
            if (ab[1] == xy[1]) Console.WriteLine("nijedan");
            else Console.WriteLine("drugi");
        }
        else
        {
            if (ab[1] == xy[1]) Console.WriteLine("prvi");
            else Console.WriteLine("?");
        }
    }
}