#include using namespace std; #define rep(i,n) for (long long i=0;i<(long long)(n);i++) #define all(v) v.begin(),v.end() using ll=long long; using pll=pair; using tll=tuple; const ll INF=(1ll<<60); template void chmin(T &a,T b){ if(a>b){ a=b; } } template void chmax(T &a,T b){ if(a> h >> w; set st; rep(i,h*w) st.insert(i+1); while(true){ double now=clock(); if(1.6<(now-start)/CLOCKS_PER_SEC){ cout << "No" << endl; return 0; } vector> ans(h,vector(w,-1)); ll s=0; rep(i,2){ rep(j,2){ ll k=mt()%(*rbegin(st)); ans[i][j]=*st.upper_bound(k); st.erase(ans[i][j]); s+=ans[i][j]; } } for(ll j=2;j st2; rep(i,h*w) st2.insert(i+1); swap(st,st2); }else{ cout << "Yes" << endl; rep(i,h){ rep(j,w){ cout << ans[i][j] << " "; } cout << endl; } return 0; } } }