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;
using ll = long long;
#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)

template<class I, class BiOp = I (*) (I, I)>
class SegTree {
private:
  int n;
  std::vector<I> dat, lazy;
  BiOp op;
  I e;

public:
  SegTree(int n_, BiOp op, I e) : op(op), e(e) {
    n = 1;
    while (n < n_) n *= 2;
    dat.resize(2 * n - 1, e);
    lazy.resize(2 * n - 1, -1);
  }

  void eval(int k, int l, int r) {
    if (lazy[k] == -1) return;
    // cerr << "eval: k = " << k << ", l = " << l << ", r = " << r << endl;
    dat[k] = lazy[k];
    if (k < n - 1) {
      lazy[2 * k + 1] = lazy[k];
      lazy[2 * k + 2] = lazy[k];
    }
    lazy[k] = -1;
  }

  void update(int a, int b, I x, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;
    // cerr << "update: a = " << a << ", b = " << b << ", x = " << x << ", k = " << k << ", l = " << l << ", r = " << r << endl;
    eval(k, l, r);
    if (b <= l || r <= a) return;
    if (a <= l && r <= b) {
      // cerr << "hey!" << endl;
      lazy[k] = x;
      eval(k, l, r);
    }
    else {
      update(a, b, x, 2 * k + 1, l, (l + r) / 2);
      update(a, b, x, 2 * k + 2, (l + r) / 2, r);
      dat[k] = min(dat[2 * k + 1], dat[2 * k + 2]);
    }
  }

  I query(int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;
    // cerr << "query: a = " << a << ", b = " << b << ", k = " << k << ", l = " << l << ", r = " << r << endl;
    eval(k, l, r);
    if (b <= l || r <= a) return e;
    if (a <= l && r <= b) return dat[k];
    I vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
    I vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
    return op(vl, vr);
  }

  void print() {
    int j = 2;
    for (int i = 0; i < 2 * n - 1; i++) {
      cerr << "(" << dat[i] << ", " << lazy[i] << ")";
      if (i == j - 2) {
        cerr << endl;
        j *= 2;
      }
      else {
        cerr << " ";
      }
    }
  }
};

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  int n, q;
  cin >> n >> q;
  SegTree<int> seg(n, [](int a, int b){return min(a, b);}, INT_MAX);

  // seg.print();

  rep(i, q) {
    // cerr << "i = " << i << endl;

    int t;
    cin >> t;
    if (t == 0) {
      int a, b, x;
      cin >> a >> b >> x;
      seg.update(a, b + 1, x);
    }
    else {
      int a, b;
      cin >> a >> b;
      cout << seg.query(a, b + 1) << endl;
    }

    // seg.print();
    // cerr << endl;
  }

  return 0;
}