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