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 <bits/stdc++.h>
using namespace std;
const int infty = (int)((1LL << 31) - 1);
struct segment_tree {
  public:
    int n, N;
    vector<int> tr, lz, lzf;
    segment_tree (vector<int> v) {
      n = v.size();
      N = 1;
      while (N < n) N <<= 1;
      tr.resize(2 * N, infty);
      lz.resize(2 * N);
      lzf.resize(2 * N, false);
      for (int i = 0; i < n; i++) tr[N + i] = v[i];
      for (int i = N - 1; i >= 1; i--) tr[i] = min(tr[2 * i], tr[2 * i + 1]);
    }
    inline void pg (int k, int L, int R) {
      if (lzf[k]) {
        tr[k] = lz[k];
        if (k < N) {
          lz[2 * k] = lz[2 * k + 1] = lz[k];
          lzf[2 * k] = lzf[2 * k + 1] = true;
        }
        lzf[k] = false;
      }
    }
    void update (int l, int r, int x, int k = 1, int L = 0, int R = -1) {
      if (R == -1) R = N;
      pg(k, L, R);
      if (r <= L || R <= l) {
        return;
      } else if (l <= L && R <= r) {
        lz[k] = x;
        lzf[k] = true;
        pg(k, L, R);
      } else {
        int C = (L + R) >> 1;
        update(l, r, x, 2 * k, L, C);
        update(l, r, x, 2 * k + 1, C, R);
        tr[k] = min(tr[2 * k], tr[2 * k + 1]);
      }
    }
    int getMin (int l, int r, int k = 1, int L = 0, int R = -1) {
       if (R == -1) R = N;
      pg(k, L, R);
      if (r <= L || R <= l) {
        return infty;
      } else if (l <= L && R <= r) {
        return tr[k];
      } else {
        int C = (L + R) >> 1;
        return min(getMin(l, r, 2 * k, L, C), getMin(l, r, 2 * k + 1, C, R));
      }
    }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, q;
  cin >> n >> q;
  segment_tree sgt(vector<int>(n, infty));
  while (q--) {
    int c;
    cin >> c;
    if (c == 0) {
      int s, t, x;
      cin >> s >> t >> x;
      sgt.update(s, ++t, x);
    } else {
      int s, t;
      cin >> s >> t;
      int ret = sgt.getMin(s, ++t);
      cout << ret << '\n';
    }
  }
  return 0;
}