fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define int long long
  5.  
  6. const long double PI = 3.14159265359;
  7.  
  8. const int MOD = 1e9 + 7;
  9.  
  10. void solve()
  11. {
  12. int n;
  13. cin >> n;
  14. if (n <= 3)
  15. cout << -1 << '\n';
  16. else
  17. {
  18. if (n % 2 == 0)
  19. {
  20. for (int i = n; i >= 1; i--)
  21. cout << i << ' ';
  22. cout << '\n';
  23. }
  24. else
  25. {
  26. for (int i = n - 1; i >= 1; i--)
  27. cout << i << ' ';
  28. cout << n << '\n';
  29. }
  30. }
  31. }
  32.  
  33. signed main(void)
  34. {
  35. ios_base::sync_with_stdio(0);
  36. cin.tie(0);
  37. cout.tie(0);
  38. if (fopen("input.txt", "r"))
  39. {
  40. freopen("input.txt", "r", stdin);
  41. freopen("output.txt", "w", stdout);
  42. }
  43. int t = 1;
  44. cin >> t;
  45. while (t--)
  46. {
  47. solve();
  48. }
  49. return 0;
  50. }
Success #stdin #stdout 0s 5348KB
stdin
3
1
4
5
stdout
-1
4 3 2 1 
4 3 2 1 5