using System;
using System.Collections.Generic;
using System.Collections;
namespace ConsoleApp1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] ulaz = Console.ReadLine().Split();
            int p1 = int.Parse(ulaz[0]);
            int p2 = int.Parse(ulaz[1]);
            ulaz = Console.ReadLine().Split();
            int r1 = int.Parse(ulaz[0]);
            int r2 = int.Parse(ulaz[1]);
            if (p1 == r1 && p2 == r2)
            {
                Console.WriteLine("nijedan");
            }
            else if (p1 == r1)
            {
                Console.WriteLine("drugi");
            }
            else if (p2 == r2)
            {
                Console.WriteLine("prvi");
            }
            else Console.WriteLine("?");
        }
    }
}