#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

//
#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) |= ~(1 << (b))
#define bitcheck(a, b) ((((a) >> (b)) & 1) == 1)
#define bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
const int INF = bit(31) - 1;
const int MOD = (int)1e9 + 7;
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

//遅延セグメント木
//区間更新、区間取得ＲMＱ

struct LazySegmentTree_RMQ {
  int n;
  vector<int> dat, lazy;
  vector<bool> lazyFlag; //区間更新用flag

  //初期化
  void init(int n_) {
    n = 1;
    while (n < n_) n *= 2;
    dat.resize(2 * n - 1, INF);
    lazy.resize(2 * n - 1, INF);
    lazyFlag.resize(2 * n - 1, false);
  }

  void eval(int k, int l, int r) {
    if (lazyFlag[k]) {
      dat[k] = lazy[k];
      if (r - l > 1) {
        lazy[2 * k + 1] = lazy[2 * k + 2] = lazy[k];
        lazyFlag[2 * k + 1] = lazyFlag[k * 2 + 2] = true;
      }
      lazyFlag[k] = false;
    }
  }

  //区間[a,b)に対して一様にxを足す。
  //呼び出し方：add(a,b,x);
  void update(int a, int b, int x, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;
    eval(k, l, r);
    if (b <= l || r <= a) return;

    //完全に被覆している場合、遅延配列に加算した後に評価する
    if (a <= l && r <= b) {
      lazy[k] = x;
      lazyFlag[k] = true;
      eval(k, l, r);
    }

    //一部被覆している場合子ノードを再帰的に計算し
    //計算済みの値を用いて、自ノードを更新する
    else {
      update(a, b, x, 2 * k + 1, l, (l + r) / 2);
      update(a, b, x, 2 * k + 2, (l + r) / 2, r);
      dat[k] = min(dat[2 * k + 1], dat[2 * k + 2]);
    }
  }

  int query(int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;
    eval(k, l, r);
    if (r <= a || b <= l) return INF;
    if (a <= l && r <= b) return dat[k];

    int vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
    int vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
    return min(vl, vr);
  }
};

LazySegmentTree_RMQ seg;

signed main() {
  int N, Q;
  cin >> N >> Q;

  seg.init(N);

  for (int i = 0; i < Q; i++) {
    int q;
    cin >> q;
    if (q) {
      int s, t;
      cin >> s >> t;
      cout << seg.query(s, t + 1) << endl;
    } else {
      int s, t, x;
      cin >> s >> t >> x;
      seg.update(s, t + 1, x);
    }
  }

  return 0;
}



Measured memory_bytes: 7052