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<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define inf 2147483647
typedef long long ll;
using namespace std;
#define N 1<<18
#define M 1<<17
int rua[N],rma[N];
void eval(int l,int r,int k){
    if(rua[k]==-1)return;
    rma[k]=rua[k];
    if(l+1<r){
    rua[k*2+1]=rua[k];
    rua[k*2+2]=rua[k];
    }
    rua[k]=-1;
}
void update(int a,int b,int l,int r,int k,int x){
    eval(l,r,k);
    if(a<=l&&r<=b){
    rua[k]=x;
    eval(l,r,k);
    return;
    }
    if(a>=r||l>=b){return;}
    update(a,b,l,(l+r)/2,k*2+1,x);
    update(a,b,(l+r)/2,r,k*2+2,x);
    rma[k]=min(rma[k*2+1],rma[k*2+2]);
}
int rmq(int a,int b,int l,int r,int k){
    eval(l,r,k);
    if(a<=l&&r<=b)return rma[k];
    if(a>=r||l>=b)return inf;
    int vl=rmq(a,b,l,(l+r)/2,k*2+1);
    int vr=rmq(a,b,(l+r)/2,r,k*2+2);
    return min(vl,vr);
}
 
int main(){
    lol(i,N)rma[i]=inf,rua[i]=-1;
    int n,q;cin>>n>>q;
    lol(i,q){
    int flag;cin>>flag;
    if(flag==0){
        int a,b,c;cin>>a>>b>>c;
        update(a,b+1,0,M,0,c);
    }
    if(flag==1){
        int a,b;cin>>a>>b;
        cout<<rmq(a,b+1,0,M,0)<<endl;
    }
    }
     
    return 0;
}