#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 main(int argc, char* argv[]) {
  registerGen(argc, argv, 1);

  int n = opt<int>("n");
  int max_x = opt<int>("max_x");
  struct Circle {
    int64_t x;
    int64_t y;
    int64_t r;
  };
  vector<Circle> circles;
  int q = 0;
  for (int p = int(sqrt(max_x)) + 1; p >= 0; p--) {
    while (p * p + q * q <= max_x) {
      q += 1;
    }
    if (p <= q) {
      break;
    }
    int x = p * p - q * q;
    int y = 2 * p * q;
    int r = p * p + q * q - max_x;
    circles.push_back({x, y, r});
    circles.push_back({y, x, r});
    circles.push_back({-x, y, r});
    circles.push_back({-y, x, r});
    circles.push_back({x, -y, r});
    circles.push_back({y, -x, r});
    circles.push_back({-x, -y, r});
    circles.push_back({-y, -x, r});
  }
  sort(circles.begin(), circles.end(), [&](const Circle& a, const Circle& b) {
    int va = (a.y > 0 || (a.y == 0 && a.x > 0));
    int vb = (b.y > 0 || (b.y == 0 && b.x > 0));
    return (va != vb ? (va == 1) : a.x * b.y - b.x * a.y > 0);
  });
  vector<Circle> fin;
  for (auto& c : circles) {
//    cerr << "sorted " << c.x << " " << c.y << " " << c.r << '\n';
    if (!fin.empty()) {
      auto d = (fin.back().x - c.x) * (fin.back().x - c.x) + (fin.back().y - c.y) * (fin.back().y - c.y);
      if (d < (fin.back().r + c.r) * (fin.back().r + c.r)) {
        continue;
      }
      d = (fin[0].x - c.x) * (fin[0].x - c.x) + (fin[0].y - c.y) * (fin[0].y - c.y);
      if (d < (fin[0].r + c.r) * (fin[0].r + c.r)) {
        continue;
      }
    }
    fin.push_back(c);
  }
  swap(circles, fin);
  circles.push_back({0, 0, max_x});
  int w = 0;
  while (int(circles.size()) < n) {
    w += 1;
    circles.push_back({0, w, max_x - w});
  }
  shuffle(circles.begin(), circles.end());

  cout << 1 << '\n';
  cout << circles.size() << '\n';
  for (auto& c : circles) {
    cout << c.x << " " << c.y << " " << c.r << '\n';
  }

  return 0;
}