static void Main(string[] args)
        {
            String[] red = Console.ReadLine().Split(' ');
            int a = Convert.ToInt32((string)red[0]);
            int b = Convert.ToInt32((string)red[1]);

            red = Console.ReadLine().Split(' ');
            int x = Convert.ToInt32((string)red[0]);
            int y = Convert.ToInt32((string)red[1]);

            if (a == x && b == y)
            {
                Console.WriteLine("nijedan");
            }
            else if (a == x)
            {
                Console.WriteLine("drugi");
            }
            else if (b == y)
            {
                Console.WriteLine("prvi");
            }
            else {
                Console.WriteLine("?");
            }

        }