#include <bits/stdc++.h>
#include "testlib.h"

using namespace std;

int const T = 10'000;
int const N = 200'000;
int const MAX = 1'000'000'000;

int main(int argc, char** argv) {
  registerValidation(argc, argv);

  int t = inf.readInt(1, T, "t");
  inf.readEoln();
  long long sumN = 0;
  for (int i = 0; i < t; ++i) {
    setTestCase(i + 1);
    int n = inf.readInt(2, N, "n");
    inf.readEoln();

    inf.readInts(n, 0, MAX, "a_i");
    inf.readEoln();
    sumN += n;  
  }

  ensuref(sumN <= N, "sum of n exceeds limit");
  inf.readEof();
  return 0;
}
