#include <bits/stdc++.h>
// using namespace std;
using std::endl;
int n, k;
void chkmax(int &x, const int &v) {
x = std::max(x, v);
}
void chkmin(int &x, const int &v) {
x = std::min(x, v);
}
struct node{
int l, r, mx1, mx2, mi1, mi2, asn;
bool tag;
}tree[8000005];
#define ls(p) (p << 1)
#define rs(p) (ls(p) | 1)
#define l(p) tree[p].l
#define r(p) tree[p].r
#define mx1(p) tree[p].mx1
#define mx2(p) tree[p].mx2
#define mi1(p) tree[p].mi1
#define mi2(p) tree[p].mi2
#define tag(p) tree[p].tag
#define asn(p) tree[p].asn
inline void pushup(const int &p) {
mx1(p) = std::max(mx1(ls(p)), mx1(rs(p)));
mx2(p) = 0;
if (mx1(ls(p)) != mx1(p)) chkmax(mx2(p), mx1(ls(p)));
if (mx1(rs(p)) != mx1(p)) chkmax(mx2(p), mx1(rs(p)));
if (mx2(ls(p)) != mx1(p)) chkmax(mx2(p), mx2(ls(p)));
if (mx2(rs(p)) != mx1(p)) chkmax(mx2(p), mx2(rs(p)));
mi1(p) = std::min(mi1(ls(p)), mi2(rs(p)));
mi2(p) = 0x7fffffff;
if (mi1(ls(p)) != mi1(p)) chkmin(mi2(p), mi1(ls(p)));
if (mi1(rs(p)) != mi1(p)) chkmin(mi2(p), mi1(rs(p)));
if (mi2(ls(p)) != mi1(p)) chkmin(mi2(p), mi2(ls(p)));
if (mi2(rs(p)) != mi1(p)) chkmin(mi2(p), mi2(rs(p)));
if (mx1(p) == mi1(p)) tag(p) = 1;
else tag(p) = 0;
}
inline void pushdown(int p) {
if (tag(p) && ~asn(p)) {
mx1(ls(p)) = mx1(rs(p)) = mi1(ls(p)) = mi1(rs(p)) = asn(ls(p)) = asn(rs(p)) = asn(p);
asn(p) = -1;
}
chkmin(mx1(ls(p)), mx1(p));
chkmin(mx1(rs(p)), mx1(p));
chkmax(mi1(ls(p)), mi1(p));
chkmax(mi1(rs(p)), mi1(p));
}
void build(int p, int l, int r) {
l(p) = l, r(p) = r;
if (l == r) {
tag(p) = 1;
return;
}
int mid = (l + r) >> 1;
build(ls(p), l, mid);
build(rs(p), mid + 1, r);
pushup(p);
}
void chkmaxlr(int p, int l, int r, int v) {
if (l > r(p) || r < l(p)) return;
if (l <= l(p) && r(p) <= r) {
chkmax(mi1(p), v);
chkmax(mx1(p), v);
if (tag(p)) {
mx1(p) = mi1(p) = asn(p) = std::max(mx1(p), v);
return;
}
if (v >= mi2(p)) {
pushdown(p);
chkmaxlr(ls(p), l, r, v);
chkmaxlr(rs(p), l, r, v);
pushup(p);
return;
}
}
pushdown(p);
chkmaxlr(ls(p), l, r, v);
chkmaxlr(rs(p), l, r, v);
pushup(p);
}
void chkminlr(int p, int l, int r, int v) {
if (l > r(p) || r < l(p)) return;
if (l <= l(p) && r(p) <= r) {
chkmin(mx1(p), v);
chkmin(mi1(p), v);
if (tag(p)) {
mx1(p) = mi1(p) = asn(p) = std::min(mx1(p), v);
return;
}
if (v <= mx2(p)) {
pushdown(p);
chkminlr(ls(p), l, r, v);
chkminlr(rs(p), l, r, v);
pushup(p);
return;
}
}
pushdown(p);
chkminlr(ls(p), l, r, v);
chkminlr(rs(p), l, r, v);
pushup(p);
}
void dfs(int p) {
if (l(p) == r(p)) {
std::cout << mx1(p) << '\n';
return;
}
pushdown(p);
dfs(ls(p));
dfs(rs(p));
}
int op, l, r, h;
int main() {
//freopen("wall.in", "r", stdin);
//freopen("wall.out", "w", stdout);
std::cin.tie(0)->sync_with_stdio(0);
std::cin >> n >> k;
build(1, 1, n);
while (k--) {
std::cin >> op >> l >> r >> h;
if (op == 1) chkmaxlr(1, l + 1, r + 1, h);
else chkminlr(1, l + 1, r + 1, h);
}
dfs(1);
return 0;
}