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 void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		double [] pp = new double[t];
		for(int i=0;i<t;i++) {
			pp[i] = 0;
		}
		double PP = 0;
		for(int i=0;i<t;i++) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			for(int j=0;j<m;j++) {
				int v = sc.nextInt();
				double r = sc.nextDouble();
				pp[i] += v*r;
				PP += r;
			}
			pp[i] /= PP;
			PP = 0;
		}
		double pph = 0;
		double R = 0;
		int p = sc.nextInt();
		int q = sc.nextInt();
		for(int i=0;i<q;i++) {
			int v = sc.nextInt();
			double r = sc.nextDouble();
			pph += v*r;
			R += r;
		}
		pph /= R;
		/*for(int i=0;i<t;i++) {
			System.err.print(pp[i]+" ");
		}
		System.err.println(pph);*/
		
		for(int i=0;i<t;i++) {
			if(pp[i]-pph > 0.0000001) {
				System.out.println("YES");
				return;
			}
		}
		System.out.println("NO");
	}
}
