using System;
using System.Collections.Generic;
namespace takmicenjeKvalifikacije
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] sr = Console.ReadLine().Split();
            int a = int.Parse(sr[0]), b = int.Parse(sr[1]);

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

            if (a == x && b > y)
                Console.WriteLine("drugi");
            else if (a > x && b == y)
                Console.WriteLine("prvi");
            else if (a == x && b == y)
                Console.WriteLine("nijedan");
            else
                Console.WriteLine("?");
        }
    }
}