using System;

class Program {
  public static void Main (string[] args) {
    string[] s = Console.ReadLine().Split();
    int a = int.Parse(s[0]), b = int.Parse(s[1]);
    s = Console.ReadLine().Split();
    int x = int.Parse(s[0]), y = int.Parse(s[1]);
    if (x < a) {
      if (y < b) { Console.WriteLine("?"); }
      else Console.WriteLine("prvi");
    }
    else {
      if (y < b) { Console.WriteLine("drugi"); }
      else Console.WriteLine("nijedan");
    }
  }
}