#include <bits/stdc++.h>
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a / gcd(a, b) * b); }
unsigned long long power(unsigned long long a, unsigned long long b) {
  a %= 1000000007;
  unsigned long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
    b >>= 1;
  }
  return res % 1000000007;
}
long long modmul(long long x, long long y) { return (x * y) % 1000000007; }
long long modadd(long long x, long long y) { return (x + y) % 1000000007; }
long long modsub(long long x, long long y) {
  return (x - y + 1000000007) % 1000000007;
}
long long fact[1000007] = {0};
void facto() {
  fact[0] = 1;
  fact[1] = 1;
  for (long long i = 2; i < 100007; i++)
    fact[i] = (fact[i - 1] * i) % 1000000007;
}
long long ncr(long long n, long long r) {
  long long res = 1;
  res = fact[n];
  res = (res * (power(fact[r], 1000000007 - 2))) % 1000000007;
  res = (res * (power(fact[n - r], 1000000007 - 2))) % 1000000007;
  return res;
}
long long npr(long long n, long long r) {
  long long res = 1;
  res = fact[n];
  res = (res * (power(fact[n - r], 1000000007 - 2))) % 1000000007;
  return res;
}
inline long long toint(const std::string &s) {
  std::stringstream ss;
  ss << s;
  long long x;
  ss >> x;
  return x;
}
inline std::string tostring(long long number) {
  std::stringstream ss;
  ss << number;
  return ss.str();
}
inline std::string tobin(long long x) { return std::bitset<63>(x).to_string(); }
using namespace std;
long long a[101] = {0};
bool vis[101] = {0};
long long solve() {
  long long n;
  cin >> n;
  for (long long i = 1; i < n + 1; i++) cin >> a[i];
  long long t;
  cin >> t;
  while (t--) {
    long long k, pos;
    cin >> k >> pos;
    memset(vis, false, sizeof(vis));
    while (k--) {
      long long p = 0;
      for (long long i = 1; i <= n; i++) {
        if (!vis[i] && a[i] > a[p]) p = i;
      }
      vis[p] = true;
    }
    long long ans = 0;
    while (pos--) {
      while (!vis[++ans])
        ;
    }
    cout << a[ans] << '\n';
  }
  return 0;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  solve();
}
