Doubt in Prateek loves candy

What to do after preparing sieve? Please help me out with this.

After preparing sieve prepare an array where arr[i] is ith prime number
Then simply iterate over the testcases and print directly using arr