#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, h;
  cin >> n >> m >> h;
  int right[m];
  int left[n];
  int g[n][m];
  for (int i = 0; i < m; ++i) cin >> right[i];
  for (int i = 0; i < n; ++i) cin >> left[i];
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      int v;
      cin >> v;
      if (v)
        g[i][j] = min(left[i], right[j]);
      else
        g[i][j] = 0;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cout << g[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
