Not able to understand the question

Please help me out in understanding the question

@kodivine0 let take an example where n=6 and q=2
and array is 1 2 3 4 5 6
so first you will find the elements which are divisble by first prime number i.e 2 and print it
2
4
6
after that your stack is reversed so now find the number which are divisble by 3 and print it
3
again your stack is reversed print the remaining element
1
5
so your final answer is 2 4 6 3 1 5
but if q=3
your final answer will be
2 4 6 3 5 1
so basically you have to find all number which are divisble by ith prime number put it into stack and print it top to bottom

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.