using System;
					
public class Program
{
	public static void Main()
	{
		string[] s = Console.ReadLine().Split();
		int a = int.Parse(s[0]);
		int b = int.Parse(s[1]);
		string[] s1 = Console.ReadLine().Split();
		int x = int.Parse(s1[0]);
		int y = int.Parse(s1[1]);
		if (x == a && y == b)
			Console.WriteLine("nijedan");
		else if (x == a && y < b)
			Console.WriteLine("drugi");
		else if ((x<a) && (y<b))
			Console.WriteLine("?");
		else 
			Console.WriteLine("prvi");
		Console.ReadLine();
	}
}