using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();int a=int.Parse(s[0]), b = int.Parse(s[1]), c, d; s = Console.ReadLine().Split();c = int.Parse(s[0]);d = int.Parse(s[1]);
            Console.WriteLine(b == d ?a == c ? "nijedan" : "prvi" : (c == a ? "drugi" : "?"));
        }
    }
}