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
//10
#include<iostream>
#include<algorithm>

using namespace std;

double in(){
  int n,m;
  cin>>n>>m;
  double ap=0;
  double p=0;
  while(m--){
    double v,r;
    cin>>v>>r;
    p+=v*r;
    ap+=r;
  }
  return p/ap;
}

int main(){
  int t;
  double m=0;
  cin>>t;
  while(t--){
    m=max(m,in());
  }
  cout<<((in()+0.0000001<m)?"YES":"NO")<<endl;
}