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<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;


const D EPS=1e-7;


int main(){
    ll t;
    cin>>t;
    vector<D> Ex(t+1,0);
    for(int i=0;i<=t;i++){
        ll n,m;
        cin>>n>>m;
        D sum=0;
        vector<pair<int,D>> A(m);
        for(auto &I:A){
            cin>>I.F>>I.S;
            sum+=I.S;
        }
        for(auto &I:A){I.S/=sum;}
        for(auto &I:A){Ex[i]+=I.F*I.S;}
    }
    for(int i=0;i<t;i++){
        if(Ex[i]>Ex[t]+EPS){cout<<"YES"<<endl; return 0;}
    }
    cout<<"NO"<<endl;
    
    
    
    
    return 0;
}

