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 <list>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli> > mat;
typedef vector<vector<bool> > matb;
typedef vector<string> vst;
typedef pair<lli,lli> pll;
typedef pair<double,double> pdd;

template<class T>
class lpsg_tree {
private:
    vector<T> lazy;
    vector<T> seg;
    T def;
    lli num;
    void push(lli k){
        if(lazy[k] == def) return;
        set(k*2+1,lazy[k]);
        set(k*2+2,lazy[k]);
        lazy[k] = def;
    }
    void set(lli k,T x){
        lazy[k] = x;seg[k] = x;
    }
    void update(lli a,lli b,T x,lli k,lli l,lli r){
        if(r <= a || b <= l) return;
        if(a <= l && r <= b) set(k,x);
        else {
            push(k);
            update(a,b,x,k*2+1,l,(r+l)/2);
            update(a,b,x,k*2+2,(l+r)/2,r);
            seg[k] = func(seg[k*2+1],seg[k*2+2]);
        }
    }
    T func(T a,T b){
        return min(a,b);
    }
    T query(lli a,lli b,lli k,lli l,lli r){
        if(r <= a || b <= l) return def;
        if(a <= l && r <= b) return seg[k];
        push(k);
        T vl = query(a,b,k*2+1,l,(l+r)/2);
        T vr = query(a,b,k*2+2,(l+r)/2,r);
        return func(vl,vr);
    }
public:
    lpsg_tree(){}
    lpsg_tree(lli n,lli d = 2147483647):lazy(n*4,d),seg(n*4,d){
        def = d;
        num = 1;
        while(n > num) num <<= 1;
    }
    void update(lli a,lli b,lli x){
        update(a,b,x,0,0,num);
    }
    T query(lli a,lli b){
        return query(a,b,0,0,num);
    }

};


lpsg_tree<lli> sg;
lli n,q;
lli c,s,t,x;

int main(){
    cin >> n >> q;
    sg = lpsg_tree<lli> (n,2147483647);
    for(lli i = 0;i < q;i++){
        cin >> c;
        if(c){
            cin >> s >> t;
            cout << sg.query(s,t+1) << endl;
        }else{
            cin >> s >> t >> x;
            sg.update(s,t+1,x);
        }
    }
    return 0;
}