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;

#define EPS (1e-7)

double get_ex()
{
    int n, m;
    cin >> n >> m;
    double v, r, p = 1, e = 0;
    for (int i = 0; i < m; i++) {
        cin >> v >> r;
        e += v * r;
        p -= r;        
    }
    return e / (1 - p);
}

int main()
{
    int t;
    double max_ex = 0;
    cin >> t;
    while (t--) {
        max_ex = max(max_ex, get_ex());        
    }
    cout << (max_ex - get_ex() > EPS ? "YES" : "NO") << endl;    
    return 0;
}