#include <bits/stdc++.h>
using namespace std;
int n, a, k, j;
pair<int, int> arr[101];
bool cmp1(pair<int, int> a, pair<int, int> b) {
  if (a.first != b.first) {
    return a.first > b.first;
  } else {
    return a.second < b.second;
  }
}
bool cmp2(pair<int, int> a, pair<int, int> b) { return a.second < b.second; }
int main(int argc, const char* argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i].first;
    arr[i].second = i;
  }
  cin >> a;
  for (int i = 0; i < a; i++) {
    sort(arr, arr + n, cmp1);
    cin >> k >> j;
    sort(arr, arr + k, cmp2);
    cout << arr[j - 1].first << "\n";
  }
}
