#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long t, n, m, i, j, k, x, y;
  cin >> n;
  vector<pair<long long, long long>> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> k;
    a[i] = {k, i};
  }
  auto cmp = [](pair<long long, long long> &a, pair<long long, long long> &b) {
    if (a.first == b.first) return a.second < b.second;
    return a.first > b.first;
  };
  sort(a.begin(), a.end(), cmp);
  auto cmp2 = [](pair<long long, long long> &a, pair<long long, long long> &b) {
    return a.second < b.second;
  };
  cin >> t;
  while (t--) {
    cin >> x >> y;
    vector<pair<long long, long long>> q(a.begin(), a.begin() + x);
    sort(q.begin(), q.end(), cmp2);
    cout << q[y - 1].first << "\n";
  }
  return 0;
}
