#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n;
  vector<pair<int, int>> v;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    v.push_back(make_pair(-x, i));
  }
  sort(v.begin(), v.end());
  int q;
  cin >> q;
  while (q--) {
    vector<pair<int, int>> ans;
    int k, p;
    cin >> k >> p;
    for (int i = 0; i < k; i++) {
      ans.push_back(make_pair(v[i].second, (-1 * v[i].first)));
    }
    sort(ans.begin(), ans.end());
    cout << ans[p - 1].second << endl;
  }
}
