#include <bits/stdc++.h>
using namespace std;
long long power(long long b, long long e, long long m) {
  if (e == 0) return 1;
  if (e % 2)
    return ((b % m) * power((b % m) * (b % m), (e - 1) / 2, m) % m) % m;
  else
    return power((b % m) * (b % m), e / 2, m) % m;
}
long long ncr(long long n, long long r) {
  long long f1 = 1;
  for (long long i = 1; i <= n; i++) {
    f1 = (f1 % 998244353 * (i) % 998244353) % 998244353;
  }
  long long f2 = 1;
  for (long long i = 1; i <= r; i++) {
    f2 = (f2 % 998244353 * (i) % 998244353) % 998244353;
  }
  long long f3 = 1;
  for (long long i = 1; i <= n - r; i++) {
    f3 = (f3 % 998244353 * i % 998244353) % 998244353;
  }
  long long k = (f1 % 998244353 * power(f2, 998244353 - 2, 998244353) %
                 998244353 * power(f3, 998244353 - 2, 998244353) % 998244353) %
                998244353;
  return k;
}
void dpv(vector<long long> v) {
  for (long long i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  cout << '\n';
}
void dpv(vector<pair<long long, long long> > v) {
  for (long long i = 0; i < v.size(); i++) {
    cout << v[i].first << " " << v[i].second << '\n';
  }
}
void dpv(set<long long> v) {
  for (auto i : v) {
    cout << i << " ";
  }
  cout << '\n';
}
long long Logn(long long n, long long k) {
  return (n > k - 1) ? 1 + Logn(n / k, k) : 0;
}
long long max(long long a, long long b) {
  if (a > b) {
    return a;
  } else {
    return b;
  }
}
string add(string s1, string s2) {
  string s3;
  long long z = s1.length() - s2.length();
  if (z < 0) {
    z = z * (-1);
  }
  for (long long i = 0; i < z; i++) {
    if (min(s1.length(), s2.length()) == s1.length()) {
      s1 = '0' + s1;
    } else {
      s2 = '0' + s2;
    }
  }
  long long c = 0;
  for (long long i = s1.length() - 1; i >= 0; i--) {
    long long z1 = s1[i] - '0';
    long long z2 = s2[i] - '0';
    long long k = (z1 + z2 + c) % 2;
    c = (z1 + z2 + c) / 2;
    s3 = char('0' + k) + s3;
  }
  if (c != 0) {
    s3 = char('0' + c) + s3;
  }
  return s3;
}
bool comp(const pair<long long, long long> &a,
          const pair<long long, long long> &b) {
  return (abs(a.first) + abs(a.second) < abs(b.first) + abs(b.second));
}
long long min(long long a, long long b) {
  if (a < b) {
    return a;
  } else {
    return b;
  }
}
bool bylength(const string &a, const string &b) {
  if (a.length() > b.length()) {
    return false;
  } else {
    return true;
  }
}
void update(long long ans[], long long l, long long r, long long x) {
  if (l > r) {
    return;
  } else {
    long long m = (l + r) / 2;
    if (l != x - 1 && ans[l] == -1) {
      ans[l] = x;
    }
    if (r != x - 1 && ans[r] == -1) {
      ans[r] = x;
    }
    if (m != x - 1 && ans[m] == -1) {
      ans[m] = x;
    }
    update(ans, l, m - 1, x);
    update(ans, m + 1, r, x);
  }
}
void oblivious() {
  long long n, k;
  cin >> n >> k;
  set<long long> s;
  for (long long i = 0; i < n; i++) {
    s.insert(i);
  }
  long long ans[n];
  memset(ans, -1, sizeof(ans));
  for (long long i = 0; i < k; i++) {
    long long l, r, x;
    cin >> l >> r >> x;
    l--;
    r--;
    x--;
    auto it1 = s.lower_bound(l);
    vector<long long> v;
    while (it1 != s.end()) {
      if (*it1 > r) {
        break;
      }
      if (*it1 != x) {
        v.push_back(*it1);
        ans[*it1] = x + 1;
      }
      it1++;
    }
    for (auto i : v) {
      s.erase(i);
    }
  }
  for (long long i = 0; i < n; i++) {
    if (ans[i] != -1) {
      cout << ans[i] << " ";
    } else {
      cout << "0 ";
    }
  }
  cout << '\n';
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    oblivious();
  }
  return 0;
}
