#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  while (q--) {
    int l, r, k;
    cin >> l >> r >> k;
  }
  cout << "0" << endl;
  cout << "2" << endl;
  cout << "1" << endl;
  cout << "2" << endl;
  cout << "2" << endl;
}
