#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.1415926535897932384626433832795L;
const long double eps = 1e-9;
const long long A = 911382323;
const long long B = 972663749;
const long long A2 = 972663749;
const long long B2 = 972663753;
const long long mod = 1e9 + 7;
const long long inf = 1e15;
const long long N = 1e5 + 500, M = 1e6 + 5;
int dd[4][2] = {{-1, 0}, {1, 0}, {0, 1}, {0, -1}};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(20);
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto &e : a) cin >> e;
  int q;
  cin >> q;
  while (q--) {
    int k, p;
    cin >> k >> p;
    set<pair<int, int>> c;
    vector<int> v;
    for (int i = 0; i < n; i++) {
      c.insert({-a[i], i});
    }
    for (int i = 0; i < k; i++) {
      v.push_back((*c.begin()).second);
      c.erase(c.begin());
    }
    sort((v).begin(), (v).end());
    cout << a[v[p - 1]] << '\n';
  }
  return 0;
}
