using System;
using System.Collections.Generic;
using System.Security;
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("?");
        if (a == x && b > y) Console.WriteLine("drugi");
        if (a == x && b == y) Console.WriteLine("nijedan");
        if (a > x && b == y) Console.WriteLine("prvi");
    }
}