#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator<<(ostream& o, const vector<T>& v) {
  int b = 0;
  for (const auto& a : v) o << (b++ ? ", " : "") << a;
  return o;
}
template <typename T>
ostream& operator<<(ostream& o, const set<T>& v) {
  int b = 0;
  for (const auto& a : v) o << (b++ ? ", " : "") << a;
  return o;
}
template <typename T, typename U>
ostream& operator<<(ostream& o, const pair<T, U>& p) {
  o << p.first << ' ' << p.second;
  return o;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<pair<int, int>> A(n);
  for (int i = 0; i < n; i++) {
    cin >> A[i].first;
    A[i].second = i;
  }
  sort(A.begin(), A.end(), [](pair<int, int> a, pair<int, int> b) {
    return a.first > b.first || (a.first == b.first && a.second < b.second);
  });
  int m;
  cin >> m;
  for (int _ = 0; _ < m; _++) {
    int k, p;
    cin >> k >> p;
    vector<pair<int, int>> B(k);
    for (int i = 0; i < k; i++) B[i] = A[i];
    sort(B.begin(), B.end(), [](pair<int, int> a, pair<int, int> b) {
      return a.second < b.second || (a.second == b.second && a.first < b.first);
    });
    cout << B[p - 1].first << endl;
  }
}
