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 main(){
	int t;
	double max=0;
	cin >> t;
	int n, m, v;
	double r, M=0, rr;
	while(0<=t--){
		M=0;rr=0;
		cin >> n >> m;
		while(m--){
			cin >> v >> r;
			M += v*r;
			rr += r;
		}
		M /= rr;
		if(0<=t && max < M) max = M;
	}
	
	cout << ((max - M > 0.0000001) ? "YES" : "NO") << endl;
}