#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

#define ELEMENT_NUM 100000

int min(int a, int b){
    
    if (a <= b) {
        return a;
    }
    else{
        return b;
    }
}

void update(int x, int y,  int *A, int * rmq, int n, int m, int offset){
    
    int idx = x/offset;
    
    A[x] = y;
    
    if ( rmq[idx] > y ) {
        rmq[idx] = y;
    }
}

int find(int x, int y,  int *A, int * rmq, int n, int m, int offset){

    int i;
    int ans = INT_MAX;
    
    int L = (x + offset - 1) / offset + 1;
    int R = y / offset;
    
    if (L <= R) {
        for (i = x; i < L * offset; i++) ans = min(ans, A[i]);
        for (i = L; i < R; i++) ans = min(ans, rmq[i]);
        for (i = R * offset; i < y; i++) ans = min(ans, A[i]);
    }else{/* minimua value is included in one bucket. */
        for (i = x; i < y; i++) ans = min(ans, A[i]);
    }
    return ans;
}



int main( ){
    
    int i, n, m, q,  com, x, y, offset;
    int * A;
    int * rmq;
    
    scanf("%d", &n);
    scanf("%d", &q);
    
    A = malloc(sizeof(int) * n);
    offset = sqrt(n);
    m = ceil(sqrt(n));
    rmq = malloc( sizeof(int) * m );

    
    for (i = 0; i < n; i++) {
        A[i] = INT_MAX;
    }
    
    for (i = 0; i < m; i++) {
        rmq[i] = INT_MAX;
    }
    
    for (i=1; i<=q; i++){
        scanf("%d %d %d", &com, &x, &y);
        
        if (com == 0) {
            update(x, y, A, rmq, n, m, offset);
        }
        else{
            printf("%d\n", find(x, y, A, rmq, n, m, offset) );
        }
    }
    
    return 0;
}