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 {
	static Scanner sc = new Scanner(System.in);
	
	public static void main(String[] args) {
		//try(Scanner sc = new Scanner(System.in)) {
			int t = sc.nextInt();
			double max = 0;
			for(int i=0; i<t; ++i) {
				max = Math.max(max, cal());
			}
			System.out.println(max > cal()+0.0000001 ? "YES":"NO");
		//}
	}
	
	static double cal() {
		int n = sc.nextInt();
		int m = sc.nextInt();
		double hope = 0;
		double rr = 0;
		for(int i=0; i<m; ++i) {
			int v = sc.nextInt();
			double r = sc.nextDouble();
			hope += v*r;
			rr += r;
		}
		return hope/rr;
		
	}
}




