using System;

namespace zad1{
    public static class Program{
        public static void Main(string[] args){
            string[] unos1 = Console.ReadLine().Split();
            int a = Convert.ToInt32(unos1[0]);
            int b = Convert.ToInt32(unos1[1]);

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

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