#include #include #include using namespace std; const int MAXN = 50010; int n, q, forced; struct aint { int arb[3 * MAXN], lazy[3 * MAXN], lazy_type[3 * MAXN]; aint() { memset (arb, 0, sizeof arb); memset (lazy, 0, sizeof lazy); } void update_nod(int nod, int type, int val) { if (forced == 1) { if (type == 0) arb[nod] = val; if (type == -1) arb[nod] = max (arb[nod], val); if (type == 1) arb[nod] = min (arb[nod], val); } else arb[nod] = val; } void update_lazy (int &nod, int &left, int &right, int &type) { lazy[right] = lazy[nod]; lazy[left] = lazy[nod]; update_nod(left, type, arb[nod]); update_nod(right, type, arb[nod]); lazy[nod] = 0; } void update (int nod, int st, int dr, int l, int r, int val, int type) { if (l <= st && dr <= r) { update_nod(nod, type, val); lazy[nod] = val; return; } int mid = (st + dr) / 2; int left = nod * 2; int right = nod * 2 + 1; if (lazy[nod]) update_lazy(nod, left, right, type); if (l <= mid) update (left, st, mid, l, r, val, type); if (r > mid) update (right, mid + 1, dr, l, r, val, type); } int query (int nod, int st, int dr, int poz, int type) { if (st == dr) return arb[nod]; int mid = (st + dr) / 2; int left = nod * 2; int right = nod * 2 + 1; if (lazy[nod]) update_lazy(nod, left, right, type); if (poz <= mid) return query (left, st, mid, poz, type); else return query (right, mid + 1, dr, poz, type); return -1; } }; aint val, how_left, how_right; int main() { // freopen("d.in", "r", stdin); cin >> n >> q; how_left.update (1, 1, n, 1, n, 1, -1); for (int i = 1; i <= 3 * n; ++i) how_right.arb[i] = n; for (int i = 1; i <= q; ++i) { int type; cin >> type; if (type == 2) { int p; cin >> p; //cerr << how_right.query(1, 1, n, p, 1); cout << val.query(1, 1, n, p, 0) << " " << how_left.query(1, 1, n, p, -1) << " " << how_right.query(1, 1, n, p, 1) << "\n"; } else { int a, b, c; cin >> a >> b >> c;// N!! int val1 = val.query(1, 1, n, a - 1, 0); int val2 = val.query(1, 1, n, b + 1, 0); if (val1 == c && a > 1) a = how_left.query(1, 1, n, a - 1, -1); if (val2 == c && b < n) b = how_right.query(1, 1, n, b + 1, 1); val.update (1, 1, n, a, b, c, 0); how_left.update(1, 1, n, a, b, a, -1); how_right.update(1, 1, n, a, b, b, 1); forced = 1; if (a > 1) how_right.update(1, 1, n, 1, a - 1, a - 1, 1); if (b < n) how_left.update(1, 1, n, b + 1, n, b + 1, -1); forced = 0; } } return 0; }