#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int main() {
  int n, m;
  long long a[N], b[N];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  memcpy(b, a, sizeof(a));
  sort(b, b + n);
  reverse(b, b + n);
  cin >> m;
  while (m--) {
    int flag = 1, k, pos;
    cin >> k >> pos;
    for (int i = k - 2; i >= 0; i--)
      if (b[i] == b[k - 1])
        flag++;
      else
        break;
    vector<int> v;
    for (int i = 0; i < n; i++) {
      if (a[i] > b[k - 1])
        v.push_back(a[i]);
      else if (a[i] == b[k - 1] && flag) {
        v.push_back(a[i]);
        flag--;
      }
    }
    cout << v[pos - 1] << endl;
  }
}
