#include <vector>
#include <set>
#include <iostream>
using i64 = int;

int node[(1 << 18)];
int lazy[(1 << 18)];

struct lazy_segment_tree {
  using T = i64;
  using L = i64;
  static inline T t_ide() { return (1LL << 31) - 1; }
  static inline L l_ide() { return (1LL << 31) - 1; }
  static inline T ope(const T& a, const T& b) { return std::min(a, b); }
  static inline L lazy_ope(const L& a, const L& b) { return b; }
  static inline T effect(const T& t, const L& l) { return l; }

  int n, h;

  lazy_segment_tree(int N) {
    n = 1;
    h = 1;
    while(n < N) n <<= 1, h++;
    for(int i = n << 1; i --> 0;) {
      node[i] = t_ide();
      lazy[i] = l_ide();
    }
  }
  inline void eff(int k, L x) {
    if(k < n << 1) {
      lazy[k] = lazy_ope(lazy[k], x);
    }
  }
  inline T eval(int k) const { return lazy[k] != l_ide() ? effect(node[k], lazy[k]) : node[k]; }

  inline void push(int k) {
    if(lazy[k] != l_ide()) {
      node[k] = eval(k);
      eff(k << 1, lazy[k]);
      eff((k << 1) | 1, lazy[k]);
      lazy[k] = l_ide();
    }
  }

  inline void infuse(int k) {
    k = k >> __builtin_ctz(k);
    while((k >>= 1)) node[k] = ope(eval(k << 1), eval((k << 1) + 1));
  }

  inline void infiltrate(int k) {
    if(k == n << 1) return;
    int kc = __builtin_ctz(k);
    for(int i = h; i --> kc;) push(k >> i);
  }

  inline void infiltrate(int l, int r) {
    if(r == n << 1) infiltrate(l);
    else {
      int hh = h;
      int x = l ^ r;
      for(; !(x >> --hh);) push(l >> hh);
      int lc = __builtin_ctz(l);
      for(int i = hh + 1; i --> lc;) push(l >> i);
      int rc = __builtin_ctz(r);
      for(int i = hh + 1; i --> rc;) push(r >> i);
    }
  }

  void update(int a, int b, L x) {
    int l = a + n;
    int r = b + n;
    infiltrate(l, r);
    while(l < r) {
      if(l & 1) eff(l++, x);
      if(r & 1) eff(--r, x);
      l >>= 1;
      r >>= 1;
    }
    infuse(a + n);
    infuse(b + n);
  }

  T sum(int l, int r) {
    l += n;
    r += n;
    infiltrate(l, r);
    T lx = t_ide();
    T rx = t_ide();
    while(l < r) {
      if(l & 1) lx = ope(lx, eval(l++));
      if(r & 1) rx = ope(eval(--r), rx);
      l >>= 1;
      r >>= 1;
    }
    return ope(lx, rx);
  }
};


#include <cstdio>

namespace niu {
  char cur;
  struct FIN {
    static inline bool is_blank(char c) { return c <= ' '; }
    inline char next() {
      return cur = getc_unlocked(stdin);
    }
    inline char peek() { return cur; }
    inline void skip() { while(is_blank(next())){} }

    FIN& operator>>(int& n) {
      bool sign = 0;
      n = 0;
      skip();
      while(!is_blank(peek())) {
        if(peek() == '-') {
          sign = 1;
          continue;
        }
        n = (n << 1) + (n << 3) + (peek() & 0b1111);
        next();
      }
      if(sign) n = -n;
      return *this;
    }
  } fin;

  char tmp[128];
  struct FOUT {
    static inline bool is_blank(char c) { return c <= ' '; }
    inline void push(char c) {
      putc_unlocked(c, stdout);
    }
    FOUT& operator<<(char c) {
      push(c);
      return *this;
    }
    FOUT& operator<<(const char* s) {
      while(*s) push(*s++);
      return *this;
    }
    FOUT& operator<<(int n) {
      if(n) {
        char* p = tmp + 127;
        bool neg = 0;
        if(n < 0) neg = 1, n = -n;
        while(n) *--p = (n % 10) | 0b00110000, n /= 10;
        if(neg) *--p = '-';
        return (*this) << p;
      }
      else {
        push('0');
        return *this;
      }
    }
  } fout;
}

int main() {
  using niu::fin;
  using niu::fout;
  i64 n, q;
  fin >> n >> q;
  
  lazy_segment_tree seg(n);
  while(q--) {
    i64 c;
    fin >> c;
    if(c == 0) {
      i64 s, t, x;
      fin >> s >> t >> x;
      seg.update(s, t + 1, x);
    }
    else {
      i64 s, t;
      fin >> s >> t;
      fout << seg.sum(s, t + 1) << '\n';
    }
  }
}



Measured memory_bytes: 5148