#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const long long mod = 1e9 + 7;
const long long N = 100 + 5, K = 105;
const int si = (1 << 20);
const long long M = 50 + 5;
const double INFdb = 1e10;
int n, m;
pair<int, int> a[N];
bool cmp(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first) {
    return a.second < b.second;
  }
  return a.first > b.first;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a + 1, a + 1 + n, cmp);
  cin >> m;
  for (int i = 1; i <= m; ++i) {
    int k, pos;
    cin >> k >> pos;
    vector<pair<int, int> > poss(k);
    for (int j = 1; j <= k; ++j) {
      poss[j - 1].first = a[j].second;
      poss[j - 1].second = a[j].first;
    }
    sort((poss).begin(), (poss).end());
    cout << poss[pos - 1].second << "\n";
  }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}
