Help me in solving TPERM problem

My issue

why this fails

My code

//Radhe Radhe
#include<bits/stdc++.h>
using namespace std;
#define ll long long int

void print3pair(int s,int n){
    for(int i=s;i<=n;i+=3){
        cout<<i<<" "<<i+2<<" "<<i+1<<" ";
    }
    
}
void Radhe(){
 ll t;
 cin>>t;
 while(t--){
     ll n;
     cin>>n;
     if(n%3==0){
        print3pair(1,n);
        cout<<endl;
     }
    else if(n%3 ==1){
         print3pair(1,n-1);
         cout<<n<<endl;
     }
     else {
         cout<<4<<" "<<5<<" "<<2<<" "<<1<<" "<<3<<" ";
         print3pair(6,n);
         cout<<endl;
     }
     }
 
}
int main(){
Radhe();
return 0;
}

Problem Link: T-Perm Practice Coding Problem - CodeChef