#include <bits/stdc++.h>
using namespace std;
int n, m, h, i, j, x, ans[1001][1001];
int main() {
  scanf("%d%d%d", &n, &m, &h);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) ans[i][j] = h;
  for (i = 1; i <= m; i++) {
    scanf("%d", &x);
    for (j = 1; j <= n; j++) ans[j][i] = min(ans[j][i], x);
  }
  for (i = 1; i <= n; i++) {
    scanf("%d", &x);
    for (j = 1; j <= m; j++) ans[i][j] = min(ans[i][j], x);
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      scanf("%d", &x);
      if (!x) ans[i][j] = 0;
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) printf("%d ", ans[i][j]);
    puts("");
  }
}
