#include <bits/stdc++.h>
using namespace std;
int T, n, m, a[1010];
pair<int, int> pp[1010];
pair<int, int> foo[1010];
bool cmp(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first)
    return a.second < b.second;
  else
    return a.first > b.first;
}
bool cmpp(pair<int, int> a, pair<int, int> b) { return a.second < b.second; }
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> pp[i].first;
  for (int i = 1; i <= n; i++) pp[i].second = i;
  sort(pp + 1, pp + 1 + n, cmp);
  cin >> m;
  while (m--) {
    for (int i = 1; i <= n; i++) foo[i] = pp[i];
    int pos, k;
    cin >> k >> pos;
    sort(foo + 1, foo + 1 + k, cmpp);
    cout << foo[pos].first << endl;
  }
}
