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) {
		int T = sc.nextInt();
		double max = 0;
		for (int i = 0; i < T; ++i) {
			max = Math.max(max, calc());
		}
		System.out.println(max > calc() + 0.0000001 ? "YES" : "NO");
	}

	static double calc() {
		int N = sc.nextInt();
		int M = sc.nextInt();
		double sum = 0;
		double sumR = 0;
		for (int i = 0; i < M; ++i) {
			int V = sc.nextInt();
			double R = sc.nextDouble();
			sum += V * R;
			sumR += R;
		}
		return sum / sumR;
	}

}