D1. Optimal Subsequences (Easy Version)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    // input
    ll N; 
    cin>>N;

    VI A(N);
    rep(i, N) cin >> A[i];
    
    auto B = A;
    RSORT(B);

    ll Q;cin>>Q;
    while(Q--){
      ll k, pos;
      cin>>k>>pos; pos--;

      ll x = B[k-1];

      ll x_num = 0;
      for(int i=k-1; i>=0; i--){
        if(B[i]==x) x_num++;
      }

      VI Ans;
      rep(i,N){
        if(A[i]>x){
          Ans.push_back(A[i]);
        }
        else if(A[i]==x){
          if(x_num){
            Ans.push_back(x);
            x_num--;
          }
        }
      }
      ll ans = Ans[pos];
      p(ans);
    }
    
    return 0;
}