using System;
class Takmicenje
{
    static void Main()
    {
        string[] s = Console.ReadLine().Split();
        int a = int.Parse(s[0]);
        int b = int.Parse(s[1]);

        string[] r = Console.ReadLine().Split();
        int x = int.Parse(r[0]);
        int y = int.Parse(r[1]);

        int r1 = a - x;
        int r2 = b - y;

        if (b == y && a != x)
            Console.WriteLine("prvi");

        else if (a == x && b != y)
            Console.WriteLine("drugi");

        else if (a == x && b == y)
            Console.WriteLine("nijedan");

        else if (r1 > 0 || r2 > 0 || r1 == r2)
            Console.WriteLine("?");


    }
}