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

using namespace std;

int main(int argc, char** argv) {
  registerGen(argc, argv, 1);
  int t = opt<int>("t");
  int minn = opt<int>("minn");
  int maxn = opt<int>("maxn");
  int minstart = opt<int>("minstart");
  int maxstart = opt<int>("maxstart");
  int minops = opt<int>("minops");
  int maxops = opt<int>("maxops");
  int r = opt<int>("r");

  cout << t << "\n";
  auto ns = rnd.partition(t, maxn, minn);
  for (int it = 0; it < t; ++it) {
    int n = ns[it];
    int start = rnd.next(minstart, maxstart);
    if (r < 3) {
      while (start % 3 != r) {
        start = rnd.next(minstart, maxstart);
      }
    }
    cout << n << "\n";
    vector<int> vals(n, start);
    for (int i = 0; i < n; ++i) {
      int ops = rnd.next(minops, maxops);
      vals[i] += ops;
      vals[(i + 1) % n] += 2 * ops;
    }
    println(vals);
  }
  return 0;
}
