using System;

public class Spojler
{
    public static void Main(string[] args)
    {
        string r1 = Console.ReadLine();
        string r2 = Console.ReadLine();
        string[] u1 = r1.Split();
        string[] u2 = r2.Split();
        int a = Convert.ToInt32(u1[0]);
        int b = Convert.ToInt32(u1[1]);
        int x = Convert.ToInt32(u2[0]);
        int y = Convert.ToInt32(u2[1]);
        if (a > x && b == y) { Console.WriteLine("prvi"); }
        else if (a == x && b > y) { Console.WriteLine("drugi"); }
        else if (b > x && a > y) { Console.WriteLine("?"); }
        else{ Console.WriteLine("nijedan"); }
        Console.ReadKey();
    }
}