#include <bits/stdc++.h>

using namespace std;

struct Tree {
  int *t, n;

  Tree( int _n, int *a ) : n(_n) {
    t = new int[2 * n];
    for (int i = 0; i < n; i++)
      t[n + i] = a[i];
    for (int i = n - 1; i > 0; i--)
      t[i] = min(t[2 * i], t[2 * i + 1]);
  }

  void change( int i, int x ) {
    t[n + i] = x;
    for (i = (n + i) / 2; i > 0; i /= 2)
      t[i] = min(t[2 * i], t[2 * i + 1]);
  }

  int get( int l, int r ) {
    int res = INT_MAX;
    for (l += n, r += n; l <= r; l >>= 1, r >>= 1) {
      if ((l & 1) == 1) res = min(res, t[l++]);
      if ((r & 1) == 0) res = min(res, t[r--]);
    }
    return res;
  }
};