#include <bits/stdc++.h>
using namespace ::std;
int d = -1;
vector<vector<int>> root;
void search() {}
int main() {
  int N, M;
  cin >> N >> M;
  root = vector<vector<int>>(N, vector<int>(N, -1));
  for (int i = 0; i < M; i++) {
    int L, R, D;
    cin >> L >> R >> D;
    root[L][R] = D;
  }
  return 0;
}
