#include <bits/stdc++.h>
using namespace std;
int front[105];
int lef[105];
int up[105][105];
int main() {
  int n, m, h;
  cin >> n >> m >> h;
  for (int i = 0; i < m; i++) {
    cin >> front[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> lef[i];
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      cin >> up[i][j];
      if (up[i][j] != 0) {
        up[i][j] = min(lef[i], front[j]);
      }
    }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (j < m - 1)
        cout << up[i][j] << " ";
      else
        cout << up[i][j];
    }
    cout << endl;
  }
  return 0;
}
