using System;
					
class Program
{
	static void Main()
	{
		string[] s = Console.ReadLine().Split();
        int[] a = new int[s.Length];
        for (int i = 0; i < s.Length; i++) a[i] = int.Parse(s[i]);
        string[] z = Console.ReadLine().Split();
        int[] b = new int[s.Length];
        for (int i = 0; i < s.Length; i++) b[i] = int.Parse(z[i]);
        if (a[0] == b[0])
        {
            if (a[1] == b[1]) Console.WriteLine("nijedan");
            else if (a[1] > b[1]) Console.WriteLine("drugi");
            else if (a[1] < b[1]) Console.WriteLine("greska");
        }
        else if (a[0] > b[0])
        {
            if (a[1] == b[1]) Console.WriteLine("prvi");
            else if (a[1] > b[1]) Console.WriteLine("?");
            else if (a[1] < b[1]) Console.WriteLine("greska");
        }
        else if (a[0] < b[0]) Console.WriteLine("greska");

	}
}