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

namespace ConsoleApplication332
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int a = int.Parse(s[0]);
            int b = int.Parse(s[1]);
            string[] s1 = Console.ReadLine().Split();
            int c = int.Parse(s1[0]);
            int d = int.Parse(s1[1]);
            if (a == c && b != d) Console.WriteLine("drugi");
            else if (b == d && a != c) Console.WriteLine("prvi");
            else if (a == c && b == d) Console.WriteLine("nijedan");
            else if (a != c && b != d) Console.WriteLine("?");
            Console.Read();
         }
    }
}