#include <bits/stdc++.h>
const int N = 1e2;
int main() {
  int n, m, h;
  int a[N], b[N], c[N][N];
  scanf("%d%d%d", &n, &m, &h);
  for (int i = 0; i < m; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &b[i]);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%d", &c[i][j]);
      if (c[i][j]) {
        c[i][j] = std::min(a[j], b[i]);
      }
      printf("%d ", c[i][j]);
    }
    printf("\n");
  }
  return 0;
}
