#include <bits/stdc++.h>
using namespace std;
pair<int, int> arr[200000];
bool com(pair<int, int> a, pair<int, int> b) { return a.second < b.second; }
int main() {
  int n, m, x, y;
  vector<pair<int, int>> v;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i].first;
    arr[i].first = -arr[i].first;
    arr[i].second = i;
  }
  sort(arr, arr + n);
  cin >> m;
  while (m--) {
    v.clear();
    cin >> x >> y;
    for (int i = 0; i < x; i++) {
      v.push_back(arr[i]);
    }
    sort(v.begin(), v.end(), com);
    cout << -v[y - 1].first << endl;
  }
  return 0;
}
