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 pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef vector<ll> vi;
typedef vector<vi> vvi;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define REP(i,k,n) for(ll i=k;i<(ll)(n);i++)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) v.begin(),v.end()
const ll inf=1001001001001001;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
vi node,lazy;
ll N=1;
void init(vi v){
    while(N<v.size())N*=2;
    node=vi(N*2-1,inf);
    lazy=vi(N*2-1,-inf);
    rep(i,v.size())node[i+N-1]=v[i];
    for(ll i=N-2;i>=0;i--)node[i]=min(node[i*2+2],node[i*2+2]);
}
void eval(ll i,ll l,ll r){
    if(lazy[i]==-inf)return;
    node[i]=lazy[i];
    if(r-l>1){
        lazy[i*2+1]=lazy[i];
        lazy[i*2+2]=lazy[i];
    }
    lazy[i]=-inf;
}
void update(ll a,ll b,ll k,ll l,ll r,ll x){
    eval(k,l,r);
    if(b<=l||r<=a)return;
    if(a<=l&&r<=b){
        lazy[k]=x;
        eval(k,l,r);
    }
    else{
        update(a,b,k*2+1,l,(l+r)/2,x);
        update(a,b,k*2+2,(l+r)/2,r,x);
        node[k]=min(node[k*2+1],node[k*2+2]);
        eval(k,l,r);
    }
}
ll getmi(ll a,ll b,ll k,ll l,ll r){
    eval(k,l,r);
    if(b<=l||r<=a)return inf;
    if(a<=l&&r<=b)return node[k];
    ll c1=getmi(a,b,2*k+1,l,(l+r)/2);
    ll c2=getmi(a,b,2*k+2,(l+r)/2,r);
    return min(c1,c2);
}
int main(){
    ll n,q;cin>>n>>q;
    vi v(n,(1ll<<31)-1);
    init(v);
    rep(i,q){
        ll c;cin>>c;
        if(c){
            ll a,b;cin>>a>>b;
            cout<<getmi(a,b+1,0,0,N)<<endl;
        }
        else{
            ll a,b,d;cin>>a>>b>>d;
            update(a,b+1,0,0,N,d);
            //rep(i,n)cout<<node[i+N-1]<<' ';
            //cout<<endl;
        }
    }
}