Help me in solving EQLIS problem

My issue

what’s wrong with my code. Please explain anyone.

My code

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

int main() {
	// your code goes here
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        if(n==2) cout<<"no"<<endl;
        else {
            cout<<"yes"<<endl;
            for(int i=1;i<=n/2;i++)
            {
                cout<<i<<" ";
            }
            for(int i=n;i>n/2;i--)
            {
                cout<<i<<" ";
            }
            cout<<endl;
        }
    }
}

Learning course: 1800 to 2000 difficulty problems
Problem Link: Equal LIS Practice Problem in 1800 to 2000 difficulty problems - CodeChef

@jinaybothra
your logic is not right.
for n =4 your code is giving wrong output.
plzz refer my code for better understanding of the logic.

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n;
	    cin>>n;
	    if(n==2)
	    cout<<"NO";
	    else if(n%2==0)
	    {
	        cout<<"YES\n";
	        cout<<n-1<<" ";
	        int i=1;
	        for(i=1;i<=n;i+=2)
	        {
	            if(i==n-1)
	            cout<<i+1<<" ";
	            else
	            cout<<i<<" ";
	        }
	        i-=3;
	        while(i>0)
	        {
	            cout<<i<<" ";
	            i-=2;
	        }
	    }
	    else
	    {
	        cout<<"YES\n";
	        //cout<<n-1<<" ";
	        int i=1;
	        for(i=1;i<=n;i+=2)
	        {
	           
	            cout<<i<<" ";
	        }
	        i-=3;
	        while(i>0)
	        {
	            cout<<i<<" ";
	            i-=2;
	        }
	    }
	    cout<<endl;
	}
	return 0;
}