#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
using ull = unsigned long long;
constexpr int N = 1e5 + 10;
constexpr int inf = 1e9 + 10;
constexpr ll llinf = 1e18 + 10;
constexpr int mod = 1e9 + 7;
void debug() {
std::cerr << "\n";
}
template<typename T, typename... Args>
void debug(T val, const Args&... args) {
std::cerr << val << " ";
debug(args...);
}
template<typename T>
void debug(const std::vector<T>& vec) {
for (const T& x : vec) std::cerr << x << ' ';std::cerr << "\n";
}
void ncl3() {
int n;
std::cin >> n;
std::vector<std::string> s(n);
std::vector mp(n, std::vector<int>(n)), ans(mp);
std::vector<int> r(n), c(n);
for (int i = 0; i < n; i++) {
std::cin >> s[i];
for (int j = 0; j < n; j++) {
mp[i][j] = (s[i][j] == '+' ? 1 : -1);
}
}
for (int i = 0; i < n; i++) {
std::cin >> r[i];
}
for (int i = 0; i < n; i++) {
std::cin >> c[i];
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (mp[i][j] == -1) {
mp[i][j] = 1;
r[i] += mp[i][j];
c[j] += mp[i][j];
ans[i][j] = 1;
}
}
}
std::set<std::pair<int, int>, std::greater<>> S;
int cr = 0, cc = 0;
for (int i = 0; i < n; i++) {
// debug(r[i], c[i]);
if (r[i] < 0 || r[i] > n || c[i] > n || c[i] < 0) {
std::cout << "NO" << "\n";
return;
}
cr+=r[i]; cc+=c[i];
S.emplace(c[i], i);
}
if(cl != cr) {
std::cout << "NO" << "\n";
}
std::vector<int> st(n);
for (int i = 0; i < n; i++) {
while (r[i]) {
auto [cnt, j] = *S.begin();
S.erase(S.begin());
// debug(i, r[i], cnt, j);
if (c[j]) {
ans[i][j] ^= 1;
r[i]--;c[j]--;
st[j] = 1;
}
else {
std::cout << "NO" << "\n";
return;
}
}
for (int j = 0; j < n; j++) {
if (st[j] == 1) {
st[j] = 0;
S.emplace(c[j], j);
}
}
}
std::cout << "YES" << "\n";
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
std::cout << ans[i][j];
}
std::cout << "\n";
}
}
/*
预处理、找性质缩小范围、集合思想、正难则反、穷举
*/
int main() {
#ifdef LOCAL
clock_t time = clock();
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int t = 1;
// std::cin >> t;
while (t--) {
ncl3();
}
#ifdef LOCAL
std::cout << "Time Used:" << clock() - time << "ms" << "\n";
#endif
return 0;
}