import java.io.*; import java.util.*; import java.math.*; class Main { public static void out (Object o) { System.out.println(o); } public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int maxExp = -1 , maxId = -1; for (int i = 0; i < n; i++) { String[] line = br.readLine().split(" "); int g = Integer.parseInt(line[0]); int d = Integer.parseInt(line[1]); int exp = g - d * 30000; if (exp > maxExp) { maxExp = exp; maxId = i + 1; } } if (maxExp * 6 >= 3000000) { for (int i = 0; i < 6; i++) out(maxId); } else { out("NO"); } } }