#include <iostream>
#include <string.h>
#include<queue>
using namespace std;
#define ll long long
#define endl '\n'
int mp[4005][4005], n, row[4005], ans[4005][4005], now[4005], now_cl[4005], cl[4005], ac_row[4005], ac_cl[4005];
int cp[4005];
bool cmp(int x, int y)
{
return cl[x] - now_cl[x] > cl[y] - now_cl[y];
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
cin >> n;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
{
char p;
cin >> p;
if (p == '+')
mp[i][j] = 1;
else
mp[i][j] = -1, ans[i][j] = 1, now[i]--, now_cl[j]--;
}
}
for (int i = 1; i <= n; i++)
{
cin >> row[i];
cp[i] = i;
}
for (int i = 1; i <= n; i++)
{
cin >> cl[i];
}
for (int i = 1; i <= n; i++)
{
sort(cp + 1, cp + n + 1, cmp);
for (int j = 1; j <= min(n, row[i] - now[i]); j++)
{
ans[i][cp[j]] = 1 - ans[i][cp[j]];
now_cl[cp[j]]++;
}
}
for(int i=1;i<=n;i++)
for (int j = 1; j <= n; j++)
{
if (ans[i][j])
ac_row[i] += mp[i][j], ac_cl[j] += mp[i][j];
}
for (int i = 1; i <= n; i++)
{
if (ac_row[i] != row[i] || ac_cl[i] != cl[i])
{
cout << "N0";
return 0;
}
}
cout << "Yes" << endl;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
cout << ans[i][j];
cout << endl;
}
return 0;
}