#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
int pos, pos1[N], t, i, j, k, m, n;
pair<int, int> a[N], b[N];
bool compare1(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first) return a.second < b.second;
  return (a.first > b.first);
}
bool compare(pair<int, int> a, pair<int, int> b) {
  return (a.second < b.second);
}
int main() {
  cin >> n;
  for (int i = (int)(1); i <= (int)(n); i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a + 1, a + n + 1, compare1);
  cin >> m;
  for (int i = (int)(1); i <= (int)(m); i++) {
    cin >> k >> pos;
    for (int j = (int)(1); j <= (int)(k); j++) {
      b[j].first = a[j].first;
      b[j].second = a[j].second;
    }
    sort(b + 1, b + k + 1, compare);
    cout << b[pos].first << "\n";
  }
  return 0;
}
