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

namespace _A__Spojler
{
    class Program
    {
        static void Main(string[] args)
        {
            string izlaz;

            int a, b, x, y;

            var u = Console.ReadLine().Split();
            a = int.Parse(u[0]);
            b = int.Parse(u[1]);

            var l = Console.ReadLine().Split();
            x = int.Parse(l[0]);
            y = int.Parse(l[1]);

            if (a == x && b == y)
            {
                izlaz = "nijedan";
            }
            else if (a != x && b != y)
            {
                izlaz = "?";
            }
            else if (a != x)
            {
                izlaz = "prvi";
            }
            else
            {
                izlaz = "drugi";
            }

        }
    }
}