#include <bits/stdc++.h>
using namespace std;
typedef struct {
  int num, pos;
} S;
S s[110];
int cmp(S a, S b) {
  if (a.num != b.num)
    return a.num > b.num;
  else
    return a.pos < b.pos;
}
int cmp1(S a, S b) { return a.pos < b.pos; }
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> s[i].num, s[i].pos = i;
  sort(s + 1, s + 1 + n, cmp);
  int t;
  cin >> t;
  while (t--) {
    int l, k;
    cin >> l >> k;
    sort(s + 1, s + 1 + l, cmp1);
    cout << s[k].num << endl;
    sort(s + 1, s + 1 + n, cmp);
  }
}
