#include int n, m; int lazy[300], v[60005]; const int lung = 200, buc = 250; void rez (int st) { int i, x, poz; if (lazy[st / lung] != -1) { poz = st / lung; x = lazy[st / lung]; for (i = poz * lung; i < (poz + 1) * lung; i ++) v[i] = x; lazy[st / lung] = -1; } } int main () { #ifndef ONLINE_JUDGE freopen ("worms.in", "r", stdin); freopen ("worms.out", "w", stdout); #endif scanf ("%d %d", &n, &m); n --; int i, st, dr, val, r, x, poz, tip; for (i = 1; i <= buc; i ++) lazy[buc] = -1; while (m --) { scanf ("%d", &tip); if (tip == 1) { scanf ("%d %d %d", &st, &dr, &val); st --; dr --; rez (st); r = st % lung; while (r <= lung - 1 && st <= dr) { v[st] = val; r ++; st ++; } x = st / lung; while (st <= dr) { lazy[x] = val; st += lung; x ++; } rez (st); r = st % lung; while (r <= lung - 1 && st <= dr) { v[st] = val; r ++; st ++; } } if (tip == 2) { scanf ("%d", &x); x --; rez (x); st = x; r = st % lung; while (r >= 0 && st >= 0 && v[st] == v[x]) { r --; st --; } if (v[st] == v[x]) { poz = st / lung; while (st > 0) { if (lazy[poz] == v[x]) { st -= lung; poz --; continue; } else if(lazy[poz] == 1 - v[x]) { break; } else { r = lung - 1; while (r >= 0 && st >= 0 && v[st] == v[x]) { r --; st --; } if (v[st] != v[x]) break; } } } if (st < 0) st = 0; dr = x; r = dr % lung; while (r < lung && dr <= n && v[dr] == v[x]) { r ++; dr ++; } if (v[dr] == v[x]) { poz = dr / lung; while (dr < n) { if (lazy[poz] == v[x]) { dr += lung; poz ++; continue; } else if (lazy[poz] == 1 - v[x]) { break; } else { r = 0; while (r < lung && dr <= n && v[dr] == v[x]) { r ++; dr ++; } if (v[dr] != v[x]) break; } } } if (dr > n) dr = n; if (v[st] != v[x]) st ++; if (v[dr] != v[x]) dr --; printf ("%d %d %d\n", v[x], st + 1, dr + 1); } } return 0; }