#include <bits/stdc++.h>
using namespace std;
string str;
bool yes(pair<long long, long long> a, pair<long long, long long> b) {
  if (a.second >= b.first) {
    return true;
  } else {
    return false;
  }
}
void reverse1(long long i, long long j) {
  while (i < j) {
    swap(str[i], str[j]);
    i++;
    j--;
  }
}
bool fun(pair<long long, long long> a, pair<long long, long long> b) {
  if (a.first != b.first) {
    return a.first > b.first;
  } else {
    return a.second < b.second;
  }
}
int main() {
  long long n;
  cin >> n;
  long long arr[n];
  long long i, j;
  for (i = 0; i < n; i++) {
    cin >> arr[i];
  }
  pair<long long, long long> list[n];
  long long temp;
  for (i = 0; i < n; i++) {
    list[i] = {arr[i], i + 1};
  }
  sort(list, list + n, fun);
  long long m;
  cin >> m;
  long long k, pos;
  for (i = 0; i < m; i++) {
    cin >> k >> pos;
    priority_queue<pair<long long, long long> > pq;
    for (j = 0; j < k; j++) {
      pq.push({list[j].second, list[j].first});
    }
    while (pq.size() > pos) {
      pq.pop();
    }
    cout << pq.top().second << endl;
  }
}
