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 unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

const int N=1<<17;
const int NIL=INT_MIN;

int mini[N*2];
int lazy[N*2];

void init(){
  for(int i=0;i<N*2;i++)lazy[i]=NIL;
}

void setlazy(int k,int v){
  lazy[k]=v;
  mini[k]=v;
}

void push(int k){
  if(lazy[k]==NIL)return ;
  setlazy(k*2,lazy[k]);
  setlazy(k*2+1,lazy[k]);

  lazy[k]=NIL;
}

void fix(int k){
  mini[k]=min(mini[k*2],mini[k*2+1]);
}

void fill(int ql,int qr,int v,int k=1,int nl=0,int nr=N){
  if(nr<=ql||qr<=nl)return ;
  if(ql<=nl&&nr<=qr){
    setlazy(k,v);
    return ;
  }
  push(k);
  int nm=(nl+nr)/2;
  fill(ql,qr,v,k*2,nl,nm);
  fill(ql,qr,v,k*2+1,nm,nr);
  fix(k);
}

int minimum(int ql,int qr,int k=1,int nl=0,int nr=N){
  if(nr<=ql||qr<=nl)return INT_MAX;
  if(ql<=nl&&nr<=qr)return mini[k];
  push(k);
  int nm=(nl+nr)/2;
  int vl=minimum(ql,qr,k*2,nl,nm);
  int vr=minimum(ql,qr,k*2+1,nm,nr);
  return min(vl,vr);
}

int main(){
	cin.sync_with_stdio(false);
  init();
  int n,q;
  cin>>n>>q;
  fill(0,n,(1<<31)-1);
  rep(i,q){
    int t;
    cin>>t;
    if(!t){
      int a,b,c;
      cin>>a>>b>>c;
      fill(a,b+1,c);
    }else{
      int a,b;
      cin>>a>>b;
      cout<<minimum(a,b+1)<<endl;
    }
  }
	return 0;
}