using System;
class HelloWorld {
  static void Main() {
    UInt64 x,y,a,b;
        string[] s = Console.ReadLine().Split();
        x = UInt64.Parse(s[0]);
        y = UInt64.Parse(s[1]);
        string[] s1 = Console.ReadLine().Split();
        a = UInt64.Parse(s1[0]);
        b = UInt64.Parse(s1[1]);
        if(x==a && b<y)
        {
            Console.WriteLine("drugi");
        }
        else if(a<x && y==b)
        {
            Console.WriteLine("prvi");
        }
        else if(x==a && y==b)
        {
            Console.WriteLine("nijedan");
        }
        else
        Console.WriteLine("?");
  }
}