#include <bits/stdc++.h>
using namespace std;
const int maxn = 103;
int n, m, a[maxn];
vector<pair<int, int> > b;
bool cmp(pair<int, int> x1, pair<int, int> x2) {
  return (x1.first > x2.first ||
          (x1.first == x2.first && x1.second < x2.second));
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) b.push_back(make_pair(a[i], i));
  sort(b.begin(), b.end(), cmp);
  cin >> m;
  vector<int> out;
  while (m--) {
    vector<int> ind;
    int k, j;
    cin >> k >> j;
    for (int i = 0; i < k; i++) ind.push_back(b[i].second);
    sort(ind.begin(), ind.end());
    out.push_back(a[ind[j - 1]]);
  }
  for (int i : out) cout << i << '\n';
  return 0;
}
