using System;

namespace ConsoleApp3
{
	class Program
	{
		static void Main( string[] args )
		{
			string[] ab = Console.ReadLine().Split();
			int a = Convert.ToInt32( ab[ 0 ] );
			int b = Convert.ToInt32( ab[ 1 ] );
			string[] xy = Console.ReadLine().Split();
			int x = Convert.ToInt32( xy[ 0 ] );
			int y = Convert.ToInt32( xy[ 1 ] );
			if( a==x && b!=y )
			{
				Console.WriteLine( "drugi" );
			}
			else if( a!=x && b==y )
			{
				Console.WriteLine( "prvi" );
			}
			else if( a==x && b==y )
			{
				Console.WriteLine( "nijedan" );
			}
			else
			{
				Console.WriteLine( "?" );
			}
		}
	}
}