#!/usr/bin/env python3 #fileencoding: utf-8 N = int(input().strip()) exp_max = 0 stage = 0 for i in range(N): tmp = [int(j) for j in input().strip().split(" ")] exp = (tmp[0] - 30000*tmp[1]) if exp > exp_max: exp_max = exp stage = i+1 print(exp_max) print(stage) if exp_max*6 >= 3000000: print("YES") for i in range(6): print(stage) else: print("NO")