// Slower C++ solution:
#include<iostream>

#include<vector>

#include<cmath>

#include<algorithm>

#include<iomanip>

#include<cassert>

#include<sstream>

#include<complex>

#include<cstdio>

#include<climits>

#include<cstdlib>

#include<deque>

#include<queue>

#include<stack>

#include<map>

#include<set>

#include<ctime>

#include<cctype>

#define REP(i,s,n) for(int i=s;i<n;i++)

#define rep(i,n) REP(i,0,n)

#define inf (2147483647)

#define EPS 1e-10

#define equals(a,b) (fabs((a)-(b)) < EPS) 

#define MAX_N 500010

 

using namespace std;

 

template<class T>

class RMQ{

private:

  int n;

  T dat[2*MAX_N-1];

public:

  void init(int n_){

    n = 1;

    while(n<n_)n*=2;

    for(int i=0;i<2*n-1;i++)dat[i] = inf;//

  }

  

// k????????????(0-indexed)???a?????????´

  void update(int k,T a){

    k += n-1;

    dat[k] = a;

    while(k > 0){

      k = (k-1)/2;

      dat[k] = min(dat[k*2+1],dat[k*2+2]);

    }

  }

  

  T query(int a,int b,int k,int l,int r){

    if(r<=a || b<=l)return inf;

    else if(a<=l && r<=b)return dat[k];

      

      T vl = query(a,b,k*2+1,l,(l+r)/2);

      T vr = query(a,b,k*2+2,(l+r)/2,r);

      return min(vl,vr);

  }

 

//n????????????§?????????????????????????\??????????£????????????¨ 

  T _query(int a,int b){

    return query(a,b,0,0,n);

  }

};

 

 

int main()

{

  int n,q,com,x,y;

  //scanf("%d%d",&n,&q);

  cin >> n >> q;

  RMQ<int> rmq;

  rmq.init(n+1);

  rep(i,q)

    {

      //scanf("%d%d%d",&com,&x,&y);

      cin >> com >> x >> y;

      if(com == 0)rmq.update(x,y);

      else        cout << rmq._query(x,y+1) << endl;

    }

 

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.786563436783902x):
#include <cstdio>

 

inline int min(const int &a, const int &b) {

    return a < b ? a : b;

}

 

#define siz 10000000

 

char buf[siz], *bit = buf;

 

inline int nextInt(void) {

    register int ret = 0;

    register int neg = false;

     

    for (; *bit < '0'; ++bit)

        if (*bit == '-')neg ^= true;

     

    for (; *bit >= '0'; ++bit)

        ret = ret * 10 + *bit - '0';

     

    return neg ? -ret : ret;

}

 

#define inf 2147483647

 

int n, m, mini[400005];

 

int find(int t, int l, int r, int x, int y) {

    if (x <= l && r <= y)

        return mini[t];

    int mid = (l + r) >> 1;

    if (y <= mid)

        return find(t << 1, l, mid, x, y);

    if (x > mid)

        return find(t << 1 | 1, mid + 1, r, x, y);

    else

        return min(

            find(t << 1, l, mid, x, mid),

            find(t << 1 | 1, mid + 1, r, mid + 1, y)

        );

}

 

void update(int t, int l, int r, int x, int y) {

    if (l == r)mini[t] = y;

    else {

        int mid = (l + r) >> 1;

        if (x <= mid)

            update(t << 1, l, mid, x, y);

        else

            update(t << 1 | 1, mid + 1, r, x, y);

        mini[t] = min(mini[t << 1], mini[t << 1 | 1]);

    }

}

 

signed main(void) {

    fread(buf, 1, siz, stdin);

 

    n = nextInt();

    m = nextInt();

 

    for (int i = 0; i <= (n << 2); ++i)mini[i] = inf;

 

    for (int i = 1; i <= m; ++i) {

        int c = nextInt();

        int x = nextInt();

        int y = nextInt();

        if (c)  // find(x, y)

            printf("%d\n", find(1, 1, n, x + 1, y + 1));

        else    // update(x, y)

            update(1, 1, n, x + 1, y);

    }

 

//  system("pause");

}