#include using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; template using V=vector; template using VV=V>; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); auto f=[&](auto f,int n)->VV{ if(n==1){ VV A(2,V(2)); A[0][1]=3,A[1][0]=3; return A; } auto B=f(f,n-1); int N=(1< C(N,V(N)); rep(i,N/2) rep(j,N/2){ C[i][j]=B[i][j]; C[i+N/2][j+N/2]=B[i][j]; } rep(i,N/2) C[i][i+N/2]=3; for(int i=N/2;i>n; if(n==1){ cout<<"No\n"; return 0; } auto A=f(f,n); int N=(1<=N/2 && A[i][j]==3){ A[i][j]=-cnt; A[j][i]=cnt; } } } } else{ int now=1; rep(i,N/2){ int cnt=0; rep(j,N/2){ if(A[i][j]==3){ cnt++; if(cnt==n-1) now*=-1; A[i][j]=now; A[j][i]=-now; now*=-1; A[i+N/2][j+N/2]=-A[i][j]; } else if(A[i][j]!=0){ cnt++; if(cnt==n-1) now*=-1; now=A[i][j]; now*=-1; A[i+N/2][j+N/2]=-A[i][j]; } } } rep(i,N/2){ int cnt=0; rep(j,N){ if(j=N/2 && A[i][j]==3){ A[i][j]=-cnt; A[j][i]=cnt; } } } } cout<<"Yes\n"; rep(i,N){ rep(j,N){ if(j) cout<<" "; cout<