#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
long long int h[110][110];
long long int n, m, hk, a[110], b[110], f[110][110];
void solve() {
  cin >> n >> m >> hk;
  for (long long int i = 1; i < m + 1; i++) cin >> a[i];
  for (long long int i = 1; i < n + 1; i++) cin >> b[i];
  for (long long int i = 1; i < n + 1; i++)
    for (long long int j = 1; j < m + 1; j++) cin >> f[i][j];
  for (long long int i = 1; i < n + 1; i++)
    for (long long int j = 1; j < m + 1; j++) h[i][j] = a[j];
  for (long long int i = 1; i < n + 1; i++) {
    for (long long int j = 1; j < m + 1; j++) {
      if (h[i][j] > b[i]) {
        h[i][j] = b[i];
      }
    }
  }
  for (long long int i = 1; i < n + 1; i++)
    for (long long int j = 1; j < m + 1; j++)
      if (f[i][j] == 0) h[i][j] = 0;
  for (long long int i = 1; i < n + 1; i++) {
    for (long long int j = 1; j < m + 1; j++) cout << h[i][j] << " ";
    cout << endl;
  }
}
int main() {
  long long int T = 1;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  while (T--) solve();
  return 0;
}
