#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int n, a[N], m;
pair<int, int> b[N];
vector<pair<int, int> > g[N];
bool inline cmp(pair<int, int> x, pair<int, int> y) {
  if (x.first != y.first) return x.first > y.first;
  return x.second < y.second;
}
bool inline cmp2(pair<int, int> x, pair<int, int> y) {
  return x.second < y.second;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", a + i), b[i] = make_pair(a[i], i);
  sort(b + 1, b + 1 + n, cmp);
  for (int i = 1; i <= n; i++) {
    g[i] = g[i - 1];
    g[i].push_back(b[i]);
    sort(g[i].begin(), g[i].end(), cmp2);
  }
  scanf("%d", &m);
  while (m--) {
    int k, p;
    scanf("%d%d", &k, &p);
    printf("%d\n", g[k][p - 1].first);
  }
  return 0;
}
