var inputParts = Console.ReadLine().Split(' ');
int a = Convert.ToInt32(inputParts[0]); 
int b = Convert.ToInt32(inputParts[1]);
var inputParts_1 = Console.ReadLine().Split(' ');
int x = Convert.ToInt32(inputParts_1[0]);
int y = Convert.ToInt32(inputParts_1[1]);

if (a == x && b == y)
{
    Console.WriteLine("nijedan");
}
else 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("?");
}