#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    b[i] = a[i];
  }
  sort(a.begin(), a.end());
  cin >> m;
  for (int i = 0; i < m; ++i) {
    int k, pos;
    cin >> k >> pos;
    int lim = a[n - k];
    int cntLim = 0, cntLimUp = 0;
    for (int j = 0; j < n; ++j) {
      if (a[j] == lim) {
        ++cntLim;
      }
      if (a[j] > lim) {
        ++cntLimUp;
      }
    }
    int needLim = k - cntLimUp;
    for (int j = 0; j < n; ++j) {
      if (b[j] > lim) {
        --pos;
      }
      if (b[j] == lim && needLim > 0) {
        --pos;
        --needLim;
      }
      if (pos == 0) {
        cout << b[j] << "\n";
        break;
      }
    }
  }
}
