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 <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
//#define INF 1145141919
#define INF 2147483647
#define MOD 1000000007
#define MAX_N (1<<17) // 10^5

struct SegTree {
  int seg[MAX_N*2-1], lazy[MAX_N*2-1];
  SegTree() {
    for (int i=0; i<MAX_N*2-1; i++) seg[i] = INF, lazy[i] = INF;
  }
  inline void setLazy(int k, int v) {
    lazy[k] = v;
    seg[k] = v;
  }
  inline void fix(int k) {
    seg[k] = min(seg[k*2+1], seg[k*2+2]);
  }
  inline void push(int k) {
    if (lazy[k] == INF) return;
    setLazy(k*2+1, lazy[k]);
    setLazy(k*2+2, lazy[k]);
    lazy[k] = INF;
  }

  void fill(int a, int b, int x, int k=0, int l=0, int r=MAX_N) {
    if (r <= a || b <= l) return;
    if (a <= l && r <= b) {
      setLazy(k, x);
      return;
    }
    push(k);
    fill(a, b, x, k*2+1, l, (l+r)/2);
    fill(a, b, x, k*2+2, (l+r)/2, r);
    fix(k);
  }

  int query(int a, int b, int k=0, int l=0, int r=MAX_N) {
    if (r <= a || b <= l) return INF;
    if (a <= l && r <= b) return seg[k];
    push(k);
    return min(
      query(a, b, k*2+1, l, (l+r)/2),
      query(a, b, k*2+2, (l+r)/2, r)
    );
  }
};

int N, Q;
SegTree seg;

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> Q;
  rep(i, Q) {
    int t;
    cin >> t;
    if (t == 0) {
      int l, r, x;
      cin >> l >> r >> x;
      seg.fill(l, r+1, x);
    }
    else {
      int l, r;
      cin >> l >> r;
      cout << seg.query(l, r+1) << "\n";
    }
  }
  return 0;
}