using System;
using System.Net.Sockets;
using System.Net;
using System.IO;
using System.Text;


namespace Bruh{

    class Program{

         static void Main(string[] args){
            string[] s = Console.ReadLine().Split();
            int a = int.Parse(s[0]);
            int b = int.Parse(s[1]);
            s = Console.ReadLine().Split();
            int x = int.Parse(s[0]);
            int y = int.Parse(s[1]);
            if(a>x && b>y){Console.WriteLine("?");return;}
            if(a>x){Console.WriteLine("prvi");return;}
            if(b>y){Console.WriteLine("drugi");return;}
            Console.WriteLine("nijedan");
         }
    }
}