Next permutation

#include
#include
using namespace std;

int main() {
int t;
cin >> t;
while(t–){
int n;
cin >> n;
int a[n];
for(int i=0; i<n; i++){
cin >> a[i];
}
next_permutation(a,a+n);
for(int i=0; i<n; i++){
cout << a[i];
}
}
return 0;
}

why is this code giving no answer?

Please save your code on ide.codingblocks.com and then share its link.

The server was down. I’ve done it thanks!

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.

could you please give me the solution to this question?
I wrote same code but didn’t pass the test cases.