using System;
using System.Text;
using System.Diagnostics;
using System.IO;
using System.Collections.Generic;
using System.Linq;

class cppboljiodcs
{
    static void Main()
    {
        string[] prviRed = Console.ReadLine().Split();
        int a = int.Parse(prviRed[0]);
        int b = int.Parse(prviRed[1]);

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

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

        //Console.ReadKey(); // OBRISI KAD ZAVRSISSSSSSS
    }
}