#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, h;
  cin >> n >> m >> h;
  int front[m], left[n], top[n][m];
  for (int i = 0; i < m; i++) cin >> front[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++) cin >> top[i][j];
  }
  int height[n][m];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (top[i][j] == 0)
        height[i][j] = 0;
      else if (front[j] < left[i])
        height[i][j] = front[j];
      else
        height[i][j] = left[i];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cout << height[i][j] << " ";
    cout << endl;
  }
  return 0;
}
