Help me in solving PRIMEPERM problem

My issue

plz give me hint…

My code

``````#include <bits/stdc++.h>
using namespace std;

int main() {
int t;
cin>>t;
int n;
while(t--){
cin>>n;
if(n<4) cout<<"-1"<<endl;
if()
}
return 0;
}

``````

Problem Link: PRIMEPERM Problem - CodeChef

include <bits/stdc++.h>
using namespace std;

bool is_prime(int num) {
if (num <= 1) return false;
if (num <= 3) return true;

``````if (num % 2 == 0 || num % 3 == 0) return false;

for (int i = 5; i * i <= num; i += 6) {
if (num % i == 0 || num % (i + 2) == 0) return false;
}

return true;
``````

}

int main() {
int t;
cin >> t;

``````while (t--) {
int n;
cin >> n;

if (n < 4) {
cout << "-1" << endl;
} else {
vector<int> permutation;
for (int i = n; i >= 1; i--) {
if (is_prime(i)) {
permutation.push_back(i);
}
}

if (permutation.size() >= 3) {
swap(permutation[0], permutation[1]);
swap(permutation[1], permutation[2]);
}

for (int num : permutation) {
cout << num << " ";
}
cout << endl;
}
}

return 0;
``````

}