import java.util.Scanner; public class Main_yukicoder231 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] g = new int[n]; int[] d = new int[n]; int[] e = new int[n]; for (int i = 0; i < n; i++) { g[i] = sc.nextInt(); d[i] = sc.nextInt(); e[i] = g[i] - 30000 * d[i]; } int max = 0; int maxi = 0; for (int i = 0; i < n; i++) { if (e[i] > max) { max = e[i]; maxi = i + 1; } } if (max * 6 >= 3000000) { for (int i = 0; i < 6; i++) { System.out.println(maxi); } } else { System.out.println("NO"); } sc.close(); } }