//edu_r156_a.cpp
#include<bits/stdc++.h>
using namespace std;
int main(){
/*ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);*/
int t;cin>>t;
while(t--){
int n;cin>>n;
bool flg=1;
if(n<=6||n==9){
flg=0;
cout<<"NO"<<"\n";
}
if(flg){
cout<<"YES"<<endl;
if(n==7){
cout<<"1 2 4"<<"\n";
}
else if(n==8){
cout<<"1 2 5"<<"\n";
}
else{
int xx,yy,zz;
int val=n/3;
int le=n-3*val;
if(le==0){
xx=1;
yy=3+1;
zz=3*(val-1)-2;
cout<<xx<<" "<<yy<<" "<<zz<<"\n";
}
else{
xx=le;
yy=3+1;
zz=3*(val-1)-1;
cout<<xx<<" "<<yy<<" "<<zz<<"\n";
}
}
}
}
return 0;
}
//7
//8
//1 2 5
//11
//1 2 8
//17
//1 2 14
//19
//1 2 16
//10
//1 2 7
//
//if n/3能整除
// n/3+5 n/3-1 n/3-4
//21
//2 8 11
//12
//1 2 10
//if n/3不能整除
//剩下1
//n/3+1 n/3+2 n/3-2
//剩下2
//n/3+2 n/3+1 n/3-1
1036D - Vasya and Arrays | 1139C - Edgy Trees |
37A - Towers | 353A - Domino |
409H - A + B Strikes Back | 1262A - Math Problem |
158C - Cd and pwd commands | 194A - Exams |
1673B - A Perfectly Balanced String | 1104B - Game with string |
1169B - Pairs | 1567D - Expression Evaluation Error |
78A - Haiku | 1287A - Angry Students |
1428A - Box is Pull | 234B - Reading |
581B - Luxurious Houses | 1481C - Fence Painting |
935A - Fafa and his Company | 22A - Second Order Statistics |
1720B - Interesting Sum | 1720A - Burenka Plays with Fractions |
3A - Shortest path of the king | 1720C - Corners |
574A - Bear and Elections | 352B - Jeff and Periods |
1244A - Pens and Pencils | 1670A - Prof Slim |
1189A - Keanu Reeves | 678A - Johny Likes Numbers |