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;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<l_l> vpl;
typedef vector<string> vs;
typedef pair<l_l,ll> lll;
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=1;i<=(n);i++)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=10100100100100100;
const ll dx[4]={1,-1,0,0};
const ll dy[4]={0,0,1,-1};
template<class T> inline bool chmin(T& a,T b){
if(a>b){
a=b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a,T b){
if(a<b){
a=b;
return true;
}
return false;
}
vl node,lazy,lazyf;
ll size,q;
ll n;
void init(){
    n=1;
    while(n<size) n*=2;
    node.resize(2*n-1,INT_MAX);
    lazy.resize(2*n-1,0);
    lazyf.resize(2*n-1,false);
}
void eval(ll l,ll r,ll pos){
    if(lazyf[pos]){
        node[pos]=lazy[pos];
        if(r-l>1){
            lazy[2*pos+1]=lazy[2*pos+2]=lazy[pos];
            lazyf[2*pos+1]=lazyf[2*pos+2]=true;
        }
        lazyf[pos]=false;
    }
    return;
}
void add(ll l,ll r,ll val,ll bottom=0,ll top=-1,ll pos=0){
    if(top<0)top=n;
    eval(bottom,top,pos);
    if(r<=bottom||top<=l)return;
    if(l<=bottom&&top<=r){
        lazy[pos]=val;
        lazyf[pos]=true;
        eval(bottom,top,pos);
    }
    else{
        add(l,r,val,bottom,(bottom+top)/2,2*pos+1);
        add(l,r,val,(bottom+top)/2,top,2*pos+2);
        node[pos]=min(node[2*pos+1],node[2*pos+2]);
    }
    return;
}
ll get_min(ll l,ll r,ll bottom=0,ll top=-1,ll pos=0){
    if(top<0)top=n;
    eval(bottom,top,pos);
    if(r<=bottom||top<=l)return INT_MAX;
    if(l<=bottom&&top<=r)return node[pos];
    ll mid=(bottom+top)/2;
    ll vl=get_min(l,r,bottom,mid,2*pos+1);
    ll vr=get_min(l,r,mid,top,2*pos+2);
    return min(vl,vr);
}
int main(){
    cin>>size>>q;
    //cout<<size<<endl;
    init();
    vl ans;
    rep(i,q){
        ll query;cin>>query;
        if(query==0){
            ll s,t,x;cin>>s>>t>>x;
            add(s,t+1,x);
        }
        else{
            ll s,t;cin>>s>>t;
            cout<<get_min(s,t+1)<<endl;
            //ll xx=get_min(s,t+1);
            //ans.pb(xx);
        }
    }
    //rep(i,n)cout<<node[i+n-1]<<endl;
    //for(auto p:ans)cout<<p<<endl;
    return 0;
}