#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007, M = 1e7 + 7;
long long powe(long long x, long long y) {
  x = x % mod, y = y % (mod - 1);
  long long ans = 1;
  while (y > 0) {
    if (y & 1) {
      ans = (1ll * x * ans) % mod;
    }
    y >>= 1;
    x = (1ll * x * x) % mod;
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  int arr[n];
  multiset<int> val;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n; i++) val.insert(-arr[i]);
  int q;
  cin >> q;
  while (q--) {
    int a, b;
    unordered_map<int, int> cont;
    cin >> a >> b;
    for (auto x : val) {
      cont[-x]++;
      a--;
      if (a == 0) break;
    }
    for (int i = 0; i < n; i++) {
      if (cont.count(arr[i]) && cont[arr[i]] > 0) {
        cont[arr[i]]--;
        b--;
      }
      if (b == 0) {
        cout << arr[i] << "\n";
        break;
      }
    }
  }
  return 0;
}
