#include <iostream>
#include <utility>
#include <random>
#include <cstdlib>
#include <algorithm>
using namespace std;

struct Node{
  int priority, cnt;
  long long int value, range_value;
  Node* right, *left;

  void init(long long int val){
    random_device rnd;
    priority = rnd();
    cnt = 1;
    value = range_value = val;
    right = left = NULL;
  }
};


// ?????¨???RMQ???????????????????£?
// ?????¨???????????£???????????£
#define NEUTRAL 2147483647
long long int func(long long int a, long long int b){ return min(a, b); }

int cnt(Node* node){ return node ? node->cnt : 0; }
long long int range_value(Node* node){ return node ? node->range_value : NEUTRAL; } // !!!
void update(Node* node){
  if(!node){ return; }
  node->cnt = cnt(node->right) + cnt(node->left) + 1;
  node->range_value = func(func(range_value(node->right), range_value(node->left)), node->value); // !!!
  return;
}


// ????????????[a, b)???????????????????????¨???
// ?????????: long long int ans = RangeQuery(root, a, b);
long long int _RQ(Node* node, int a, int b, int l, int r){
  if(node == NULL || r <= a || b <= l){ return NEUTRAL; }
  if(a <= l && r <= b){ return range_value(node); }
  
  long long int vl = _RQ(node->left, a, b, l, l + cnt(node->left));
  long long int vr = _RQ(node->right, a, b, l + cnt(node->left) + 1, r);
  long long int vm = (a <= l + cnt(node->left) && l + cnt(node->left) < b) ? node->value : NEUTRAL;
  long long int ans = func(func(vl, vr), vm);
  return ans;
}
long long int RangeQuery(Node* root, int a, int b){ return _RQ(root, a, b, 0, cnt(root)); }


// k?????????????´????????´¢
// ?????????: Node *ans = search(root, k);
Node* search(Node *node, int k){
  if(node == NULL || cnt(node->left) == k){ return node; }
  if(k < cnt(node->left)){ return search(node->left, k); }
  else{ return search(node->right, k - cnt(node->left) - 1); }
  return NULL;
}


// k?????????????´??????????v????????´
// ?????????: change(root, k, v);
Node *change(Node *node, int k, long long int v){
  if(node == NULL){ return NULL; }
  
  Node *result;
  if(cnt(node->left) == k){
    node->value = v;
    result = node;
  }
  if(k < cnt(node->left)){ result = change(node->left, k, v); }
  else{ result = change(node->right, k - cnt(node->left) - 1, v); }
  
  update(node);
  return result;  
}


// l????????¨????????¨?????¨????????´???r????????¨????????¨?????¨????????????
// ?????????: root = (root, s);
Node* merge(Node *l, Node *r){
  if(!l){ return r; }
  if(!r){ return l; }

  if(l->priority > r->priority){
    l->right = merge(l->right, r);
    update(l);
    return l;
  }
  else{
    r->left = merge(l, r->left);
    update(r);
    return r;
  }
}


// node????????¨????????¨?????¨???k?????????????´???§??????
// ?????????: pair<Node*, Node*> s = split(root, k);
pair<Node*, Node*> split(Node* node, int k){
  if(!node){ return pair<Node*, Node*>(NULL, NULL); }
  if(k <= cnt(node->left)){
    pair<Node*, Node*> s = split(node->left, k);
    node->left = s.second;
    update(node);
    return make_pair(s.first, node);
  }
  else{
    pair<Node*, Node*> s = split(node->right, k - cnt(node->left) - 1);
    node->right = s.first;
    update(node);
    return make_pair(node, s.second);
  }
}


// root????????¨????????¨???k????????????v????????\??????
// ?????????: root = insert(root, k, v);
Node* insert(Node* root, int k, int v){
  Node* newNode = (Node *)malloc(sizeof(Node));
  newNode->init(v);
  if(root == NULL){ return newNode; }
  pair<Node*, Node*> s = split(root, k);
  return merge(merge(s.first, newNode), s.second);
}


// root????????¨????????¨?????????k?????????????´????????????????
// ?????????: root = erase_position(root, k);
Node* erase(Node* root, int k){
  pair<Node*, Node*> s2 = split(root, k);
  pair<Node*, Node*> s1 = split(s2.first, k - 1);
  free(s1.second);
  return merge(s1.first, s2.second);
}


// ???????????°??????
void print(Node* node){
  if(node == NULL){ return; }
  cout << "(";
  print(node->left);
  cout << "[" << node->value << "/" << node->range_value << "]";
  print(node->right);
  cout << ")";
}
void println(Node *root){
  print(root);
  cout << endl;
}


int main(void){
  int n, q;
  cin >> n >> q;
  
  Node *root = NULL;
  for(int i = 0; i < n; i++){ root = insert(root, i, NEUTRAL); }
  
  for(int i = 0; i < q; i++){
    long long int c, x, y;
    cin >> c >> x >> y;
    if(c == 0){ change(root, x, y); }
    else{ cout << RangeQuery(root, x, y + 1) << endl; }
  }

  
  return 0;
}

Measured memory_bytes: 7804