Problem: Write a program which manipulates a sequence A = {a0, a1, . . . , an−1} with the following operations:

* update(s, t, x): change as, as+1, ..., at to x.
* find(s, t): report the minimum element in as, as+1, ..., at.



Note that the initial values of ai (i = 0, 1, . . . , n−1) are 231-1.

Constraints

* 1 ≤ n ≤ 100000
* 1 ≤ q ≤ 100000
* 0 ≤ s ≤ t < n
* 0 ≤ x < 231−1

Input


n q
query1
query2
:
queryq


In the first line, n (the number of elements in A) and q (the number of queries) are given. Then, ith query queryi is given in the following format:


0 s t x


or


1 s t


The first digit represents the type of the query. '0' denotes update(s, t, x) and '1' denotes find(s, t).

Output

For each find operation, print the minimum value.

Examples

Input

3 5
0 0 1 1
0 1 2 3
0 2 2 2
1 0 2
1 1 2


Output

1
2


Input

1 3
1 0 0
0 0 0 5
1 0 0


Output

2147483647
5

Solution (in CPP):

Solution:
#include <iostream>
#include <climits>
#include <algorithm>

#define lson l, m, o << 1
#define rson m + 1, r, o << 1 | 1

const int N = 1e5 + 1;

int mn[N << 2];
int lazy[N << 2];

void up(int o) {
  mn[o] = std::min(mn[o << 1], mn[o << 1 | 1]);
}

void down(int o) {
  if (lazy[o] != -1) {
    mn[o << 1] = lazy[o];
    mn[o << 1 | 1] = lazy[o];
    lazy[o << 1] = lazy[o];
    lazy[o << 1 | 1] = lazy[o];
    lazy[o] = -1;
  }
}

void build(int l, int r, int o) {
  lazy[o] = -1;
  if (l == r) {
    mn[o] = INT_MAX;
    return;
  }
  int m = (l + r) >> 1;
  build(lson);
  build(rson);
  up(o);
}

void modify(int v, int L, int R, int l, int r, int o) {
  if (L <= l && R >= r) {
    lazy[o] = v;
    mn[o] = v;
    return;
  }
  down(o);
  int m = (l + r) >> 1;
  if (L <= m) modify(v, L, R, lson);
  if (R > m) modify(v, L, R, rson);
  up(o);
}

int query(int L, int R, int l, int r, int o) {
  if (L <= l && R >= r) {
    return mn[o];
  }
  down(o);
  int m = (l + r) >> 1;
  int res = INT_MAX;
  if (L <= m) res = std::min(res, query(L, R, lson));
  if (R > m) res = std::min(res, query(L, R, rson));
  return res;
}

int main() {
  int n, q;
  while (std::cin >> n >> q) {
    build(1, n, 1);
    while (q --) {
      int op;
      std::cin >> op;
      if (op == 0) {
        int l, r, v;
        std::cin >> l >> r >> v;
        l ++;
        r ++;
        modify(v, l, r, 1, n, 1);
      } else {
        int l, r;
        std::cin >> l >> r;
        l ++;
        r ++;
        std::cout << query(l, r, 1, n, 1) << std::endl;
      }
    }
  }
  return 0;
}