main.cpp (732B)
1 #include <iostream> 2 #include <vector> 3 #include <unordered_set> 4 #include <unordered_map> 5 #include <algorithm> 6 #include <queue> 7 8 #define ll long long 9 10 using namespace std; 11 12 // don't we just have to ensure the first number is a non-prime? 13 14 int main() { 15 16 int testCases, n; 17 cin >> testCases; 18 19 for(int z = 0; z < testCases; ++z) { 20 cin >> n; 21 if (n <= 3) { 22 cout << -1 << endl; 23 continue; 24 } 25 else { 26 cout << 4 << " "; 27 for(int i = 2; i <= n; ++i) { 28 if(i == 4) { 29 cout << 1 << " "; 30 continue; 31 } 32 cout << i << " "; 33 } 34 } 35 cout << endl; 36 } 37 }