n = gets.chomp.to_i is = [] exp = 0 for i in 1..n g, d = gets.chomp.split.map(&:to_i) if (3E6 - exp) / (6 - is.size) <= g - 3E4 * d exp += g - 3E4 * d is << i end end if is.size == 0 puts 'NO' else puts 'YES' for i in 0..5 puts is[i % is.size] end end