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
#include<iostream>
using namespace std;
int n, p, q; long double a, b, c[100000];
int main() {
	cin >> n;
	for (int i = 0; i <= n; i++) {
		cin >> p >> q; long double d = 0.0l;
		for (int j = 0; j < q; j++) {
			cin >> a >> b; c[i] += a*b; d += b;
		}
		c[i] /= d;
	}
	bool OK = false;
	for (int i = 0; i < n; i++) {
		if (c[i] - 1e-7 > c[n])OK = true;
	}
	if (OK == true)cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}