#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
long long int lcm(long long int a, long long int b) {
  return (a * b) / gcd(a, b);
}
long long int sqr(long long int n) { return n * n; }
vector<bool> SieveOfEratosthenes(long long int num) {
  vector<bool> soe;
  soe.assign(num + 1, true);
  soe[0] = false;
  soe[1] = false;
  for (long long int i = 2; i * i <= num; i++) {
    if (soe[i] == true) {
      for (long long int j = i * 2; j <= num; j += i) soe[j] = false;
    }
  }
  return soe;
}
long long int bs(vector<long long int> &v, long long int l, long long int r,
                 long long int key) {
  while (l + 1 < r) {
    long long int mid = (l + r) / 2;
    if (v[mid] > key)
      r = mid;
    else
      l = mid;
  }
  return l;
}
long long int mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  cin >> n;
  vector<long long int> arr;
  for (long long int i = 0; i < n; i++) {
    long long int temp;
    cin >> temp;
    arr.push_back(temp);
  };
  vector<long long int> v = arr;
  sort(v.begin(), v.end());
  long long int m;
  cin >> m;
  while (m--) {
    long long int k, pos;
    cin >> k >> pos;
    map<long long int, long long int> ans;
    for (int i = n - 1; i >= n - k; --i) {
      ans[v[i]]++;
    }
    vector<long long int> fin;
    for (int i = 0; i < n; ++i) {
      if (ans[arr[i]]) {
        fin.push_back(arr[i]);
        ans[arr[i]]--;
      }
    }
    cout << fin[pos - 1] << '\n';
  }
}
