#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=105,M=5005;
int mp[N][N];
int id[N][N],cnt;
int cx[M],cy[M],col[M];
int f[M<<1];
vector<int>G[M];
int ansp[N],ansq[N];
int n;
int find(int x){return f[x]==x?x:f[x]=find(f[x]);}
bool iscon(int x,int y){return find(x)==find(y);}
bool merge(int x,int y){
x=find(x),y=find(y);
if(x==y)return 0;
f[x]=y;return 1;
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin>>n;
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
cin>>mp[i][j];
for(int i=1;i<=n;i++)
for(int j=i+1;j<=n;j++)
id[i][j]=++cnt,cx[cnt]=i,cy[cnt]=j;
for(int i=1;i<=cnt+cnt;i++)f[i]=i;
for(int i=1;i<=n;i++)
for(int j=i+1;j<=n;j++)
for(int k=j+1;k<=n;k++){
if((mp[i][j]&&mp[j][k]&&mp[i][k])||(!mp[i][j]&&!mp[j][k]&&!mp[i][k]))continue;
if((mp[i][j]&&mp[i][k])||(!mp[i][j]&&!mp[i][k])){
if(iscon(id[i][j],id[i][k]+cnt)){cout<<"NO\n";return 0;}
merge(id[i][j],id[i][k]),merge(id[i][j]+cnt,id[i][k]+cnt);
}
if((mp[i][j]&&mp[j][k])||(!mp[i][j]&&!mp[j][k])){
if(iscon(id[i][j],id[j][k])){cout<<"NO\n";return 0;}
merge(id[i][j],id[j][k]+cnt),merge(id[i][j]+cnt,id[j][k]);
}
if((mp[i][k]&&mp[j][k])||(!mp[i][k]&&!mp[j][k])){
if(iscon(id[i][k],id[j][k]+cnt)){cout<<"NO\n";return 0;}
merge(id[i][k],id[j][k]),merge(id[i][k]+cnt,id[j][k]+cnt);
}
}
// bool fl=1;
// while(fl){
// fl=0;
for(int i=1;i<=n;i++)
for(int j=i+1;j<=n;j++)
for(int k=j+1;k<=n;k++){
if(!((mp[i][j]&&mp[j][k]&&mp[i][k])||(!mp[i][j]&&!mp[j][k]&&!mp[i][k])))continue;
if(iscon(id[i][j],id[i][k]+cnt)){
if(iscon(id[i][j],id[j][k])){cout<<"NO\n";return 0;}
fl|=merge(id[i][j],id[j][k]+cnt),fl|=merge(id[i][j]+cnt,id[j][k]);
}
if(iscon(id[i][j],id[j][k])){
if(iscon(id[i][k],id[j][k]+cnt)){cout<<"NO\n";return 0;}
fl|=merge(id[i][k],id[j][k]),fl|=merge(id[i][k]+cnt,id[j][k]+cnt);
}
if(iscon(id[i][k],id[j][k]+cnt)){
if(iscon(id[i][j],id[i][k]+cnt)){cout<<"NO\n";return 0;}
fl|=merge(id[i][j],id[i][k]),fl|=merge(id[i][j]+cnt,id[i][k]+cnt);
}
}
// }
for(int i=1;i<=n;i++)ansp[i]=ansq[i]=1;
for(int i=1;i<=cnt;i++){
if(!col[i])col[i]=1;
for(int j=i+1;j<=cnt;j++){
if(col[j])continue;
if(iscon(i,j))col[j]=col[i];
if(iscon(i,j+cnt))col[j]=3-col[i];
}
if(!mp[cx[i]][cy[i]]){
if(col[i]==1)ansp[cx[i]]++,ansq[cy[i]]++;
else ansp[cy[i]]++,ansq[cx[i]]++;
}
else{
if(col[i]==1)ansp[cx[i]]++,ansq[cx[i]]++;
else ansp[cy[i]]++,ansq[cy[i]]++;
}
}
cout<<"YES\n";
for(int i=1;i<=n;i++)cout<<ansp[i]<<' ';cout<<'\n';
for(int i=1;i<=n;i++)cout<<ansq[i]<<' ';cout<<'\n';
return 0;
}