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>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

int main() {
  int t;
  cin >> t;
  double ma = 0;
  REP(i, t) {
    int n, m;
    cin >> n >> m;
    double tmp = 0;
    double v[100], r[100];
    double R = 0;
    REP(i, m) {
      cin >> v[i] >> r[i];
      R += r[i];
    }
    REP(i, m)
      tmp += v[i]*r[i]/R;
    ma = max(ma, tmp);
  }
  int n, m;
  cin >> n >> m;
  double exp = 0;
  double v[100], r[100];
  double R = 0;
  REP(i, m) {
    cin >> v[i] >> r[i];
    R += r[i];
  }
  REP(i,m) {
    exp += v[i]*r[i]/R;
  }

  cout <<  ((ma > exp+0.0000001) ? "YES" : "NO") << endl;

}