#include <bits/stdc++.h>
#define low(x) ((x) & (-(x) ) )
#define E(x) ((x) * (x))
#define ma make_pair
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define per(a,b,c) for(int a=b;a>=c;a--)
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
char ch1;
template<class T>
inline void rd(T& x) {
x = 0; bool w = 0;
ch1 = getchar();
while (!isdigit(ch1)) { ch1 == '-' && (w = 1), ch1 = getchar(); }
while (isdigit(ch1)) { x = (x << 1) + (x << 3) + (ch1 & 15), ch1 = getchar(); }
w && (x = (~x) + 1);
}
template<class T>
inline void wr(T x)
{
if (x < 0) x = -x, putchar('-');
if (x < 10) {
putchar(x + 48);
return;
}
T L = x / 10;
wr(L);
putchar(x - ((L << 1) + (L << 3)) + 48);
}
/*int head[N],tot;
struct edge{
int to,nxt;
}e[M];
void add(int u,int v){
e[++tot].to = v;
e[tot].nxt = head[u];
head[u] = tot;
}*/
bool cp(int a,int b){return a > b;} // \xb4\xf3\xb5\xbdС
int gcd(int a,int b){
if(b == 0)return a;
return gcd(b,a % b);
}
LL exgcd(LL a, LL b, LL &x, LL &y){
if(b == 0){
x = 1, y = 0;
return a;
}
LL d = exgcd(b, a % b, y, x);
y -= a / b * x;
return d;
}
int T;
int ans[32];
void solve(ll n){
if(n%4==0){
cout<<"NO\n";
return;
}
cout<<"YES\n";
bool ok = true;
per(i,31,0){
if(ok){
if(n&(1<<i))ans[i] = 1;
else{
ok = false;
if(i==0)ans[i] = 0;
else ans[i] = 1;
}
}
else{
ans[i] = -1
if(n&(1<<i))ok = true;
}
}
rep(i,0,31){
cout<<ans[i]<<' ';
if(i%8==7)cout<<'\n';
}
}
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
ll t,n;
while(t--){
cin>>n;
solve(n);
}
return 0;
}