#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<pair<int, int> > sz;
vector<pair<int, int> > q;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    sz.push_back({-x, i});
  }
  sort(sz.begin(), sz.end());
  cin >> m;
  for (int i = 1; i <= m; i++) {
    int a, b;
    cin >> a >> b;
    q.clear();
    for (int i = 0; i < a; i++) {
      q.push_back({sz[i].second, sz[i].first});
    }
    sort(q.begin(), q.end());
    cout << -q[b - 1].second << "\n";
  }
  return 0;
}
