#ifdef DEBUG
#  define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include "testlib.h"
#define ff first
#define ss second
#define szof(x) ((int)x.size())
#ifndef LOCAL
#  define cerr __get_ce
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef unsigned long long ull;

using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename K, typename V> using ordered_map = tree<K, V, less<K>, rb_tree_tag, tree_order_statistics_node_update>;

int const INF = (int)1e9 + 1e3;
ll const INFL = (ll)1e18 + 1e6;

int main(int argc, char* argv[]) {
  registerGen(argc, argv, 1);

  int t = opt<int>("t");
  int min_n = opt<int>("min_n");
  int max_n = opt<int>("max_n");
  int max_x = opt<int>("max_x");
  int max_r = opt<int>("max_r");

  auto ns = rnd.partition(t, max_n, min_n);
    
  cout << t << '\n';
  for (int q = 0; q < t; q++) {
    int n = ns[q];
    cout << n << '\n';

    #ifdef LOCAL
      cerr << "test " << q << ": n = " << n << '\n';
    #endif

    vector<int64_t> x(n), y(n), r(n);
    for (int i = 0; i < n; i++) {
      while (true) {
        x[i] = rnd.next(-max_x, max_x);
        y[i] = rnd.next(-max_x, max_x);
        r[i] = rnd.next(1, max_r);
        bool ok = true;
        for (int j = 0; j < i; j++) {
          if (x[i] == x[j] && y[i] == y[j] && r[i] == r[j]) {
            ok = false;
            break;
          }
          auto dist = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);
          auto lo = (r[i] - r[j]) * (r[i] - r[j]);
          auto hi = (r[i] + r[j]) * (r[i] + r[j]);
          if (lo < dist && dist < hi) {
            ok = false;
            break;
          }
        }
        if (ok) {
          break;
        }
      }
      cout << x[i] << " " << y[i] << " " << r[i] << '\n';
    }
  }

  return 0;
}