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
/*
 * 2363.cc: Unequal Dice
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const double DELTA = 1e-7;

/* typedef */

/* global variables */

/* subroutines */

double calc_ev() {
  int n, m;
  cin >> n >> m;

  double esum = 0.0, rsum = 0.0;
  for (int i = 0; i < m; i++) {
    double v, r;
    cin >> v >> r;
    esum += v * r;
    rsum += r;
  }

  return esum / rsum;
}

/* main */

int main() {
  int t;
  cin >> t;

  double maxe = 0.0;

  for (int i = 0; i < t; i++) {
    double e = calc_ev();
    if (maxe < e) maxe = e;
  }

  double pe = calc_ev();

  bool ok = (maxe - pe > DELTA);
  cout << (ok ? "YES" : "NO") << endl;
  return 0;
}