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<bits/stdc++.h>
using namespace std;
double eps=0.0000001;

double solve(){
  int n,m;
  double a=0,b=0,num=0,p=0;
  cin>>n>>m;
  for(int i=0;i<m;i++){
    cin>>num>>p;
    a+=p*num;
    b+=p;
  }
  return a/b;
}

int main(){
  int t;
  cin>>t;
  double maxm=0;
  for(int i=0;i<t;i++)maxm=max(maxm,solve());
  if(maxm>solve()+eps)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}