#include <bits/stdc++.h>
using namespace std;
bool comp(const pair<long long, long long> &a,
          const pair<long long, long long> &b) {
  return (a.second < b.second);
}
signed main() {
  long long n;
  cin >> n;
  vector<long long> arr(n);
  for (long long i = 0; i < n; i++) cin >> arr[i];
  vector<pair<long long, long long>> brr;
  for (long long i = 0; i < n; i++) brr.push_back(make_pair(arr[i], i));
  vector<pair<long long, long long>> crr(brr.begin(), brr.end());
  sort(brr.begin(), brr.end());
  reverse(brr.begin(), brr.end());
  long long m;
  cin >> m;
  while (m--) {
    long long k, pos;
    cin >> k >> pos;
    long long x = brr[k - 1].first;
    vector<pair<long long, long long>> ans;
    long long c = 0;
    for (long long i = 0; i < n; i++) {
      if (crr[i].first > x) {
        ans.push_back(crr[i]);
        c++;
        if (c == k) break;
      }
    }
    for (long long i = 0; i < n; i++) {
      if (crr[i].first == x) {
        ans.push_back(crr[i]);
        c++;
        if (c == k) break;
      }
    }
    sort(ans.begin(), ans.end(), comp);
    cout << ans[pos - 1].first << endl;
  }
  return 0;
}
