#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, l;
  int x, y, z;
  bool flag = 0;
  int n;
  cin >> n;
  vector<long long> a(n);
  vector<long long> b(n);
  for (i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  int m;
  cin >> m;
  sort(b.begin(), b.end());
  reverse(b.begin(), b.end());
  for (i = 0; i < m; i++) {
    cin >> x >> y;
    flag = 0;
    int ans;
    vector<long long> put;
    for (j = 0; j < x; j++) put.push_back(b[j]);
    int count = 0;
    for (j = 0; j < n; j++) {
      for (k = 0; k < put.size(); k++) {
        if (put[k] == a[j]) {
          count++;
          if (count == y) {
            flag = 1;
            ans = a[j];
            break;
          } else {
            put.erase(put.begin() + k);
          }
          break;
        }
      }
      if (flag == 1) break;
    }
    cout << ans << endl;
  }
  return 0;
}
