Time Limit: 8 sec / Memory Limit: 64 MB





Example

Input

2
4 2
4 0.4000000
3 0.5000000
4 1
5 0.3333333
5 3
5 0.7777777
4 0.1111111
2 0.0001111


Output

YES
import java.util.Scanner;

public class Main {
	
	public static final double EPS = 0.0000001;
	
	public static void main(String[] args) {

		final Scanner sc = new Scanner(System.in);

		final int t = sc.nextInt();
		
		double[] PROB = new double[t + 1];
		
		for(int i = 0; i <= t; i++){
			final int n = sc.nextInt();
			final int m = sc.nextInt();
			
			double prob_sum = 0;
			double exp = 0;
			
			for(int j = 0; j < m; j++){
				final int v = sc.nextInt();
				final double p = sc.nextDouble();
				
				prob_sum += p;
				exp += v * p;
			}
			
			PROB[i] = exp / prob_sum;
		}
		
		boolean flag = false;
		for(int i = 0; i < t; i++){
			if(PROB[t] + EPS < PROB[i]){
				flag = true;
				break;
			}
		}
		
		System.out.println(flag ? "YES" : "NO");
	}

}