#include<bits/stdc++.h>
#define P make_pair
using namespace std;
bool res[4001][4001];
int z[4001],h[4001];
int pos[4001],n,pos2[4001];
vector<int> vec1,vec2,vec3;
bool comp(int x,int y)
{
return z[x]<z[y];
}
bool comp2(int x,int y)
{
return h[x]>h[y];
}
void gb()
{
vec3.clear();
int l=0,r=0;
while(l<vec1.size()&&r<vec2.size())
{
if(h[vec1[l]]>h[vec2[r]])
{
vec3.push_back(vec1[l++]);
}
else vec3.push_back(vec2[r++]);
}
while(l<vec1.size()) vec3.push_back(vec1[l++]);
while(r<vec2.size()) vec3.push_back(vec2[r++]);
swap(vec3,vec1);
}
signed main()
{
scanf("%d",&n);
for(int i=1;i<=n;++i)
{
for(int j=1;j<=n;++j)
{
char c;
cin>>c;
if(c=='+') res[i][j]=false;
else res[i][j]=true;
}
}
for(int i=1;i<=n;++i) scanf("%d",&z[i]),pos[i]=i;
for(int i=1;i<=n;++i) scanf("%d",&h[i]),pos2[i]=i;
for(int i=1;i<=n;++i)
{
for(int j=1;j<=n;++j)
{
if(res[i][j]==true)
{
z[i]++;
h[j]++;
}
}
}
for(int i=1;i<=n;++i) pq.push(P(h[i],i));
sort(pos+1,pos+1+n,comp);
sort(pos2+1,pos2+1+n,comp2);
for(int i=1;i<=n;++i) vec1.push_back(pos2[i]);
for(int i=1;i<=n;++i)
{
if(z[pos[i]]>n||z[pos[i]]<0) {cout<<"No";return 0;}
vec2.clear();
for(int j=0;j<z[pos[i]];++j)
{
h[vec1[j]]--;
res[pos[i]][vec1[j]]^=1;
vec2.push_back(vec1[j]);
}
vec3.clear();
for(int j=z[pos[i]];j<n;++j) vec3.push_back(vec1[j]);
swap(vec3,vec1);
gb();
}
for(int i=1;i<=n;++i)
{
if(h[i])
{
cout<<"No";
return 0;
}
}
cout<<"Yes\n";
for(int i=1;i<=n;++i)
{
for(int j=1;j<=n;++j)
{
if(res[i][j]) cout<<"1";
else cout<<"0";
}
cout<<endl;
}
}