#include <bits/stdc++.h>
using namespace std;
int max(int a, int b) {
  if (a > b) {
    return a;
  } else {
    return b;
  }
}
int main() {
  int n, i, j, m, h;
  cin >> n >> m >> h;
  int front[m], left[n], top[n][m], ans[m][n];
  for (i = 0; i < m; i++) {
    cin >> front[i];
  }
  for (i = 0; i < n; i++) {
    cin >> left[i];
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> top[i][j];
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      int temp = min(front[j], left[i]);
      if (top[i][j] == 1) {
        cout << temp << " ";
      } else {
        cout << 0 << " ";
      }
    }
    cout << '\n';
  }
}
