#include <bits/stdc++.h>
using namespace std;
int a[105], b[105], c[105][105];
int main() {
  int n, m, h;
  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]);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (c[i][j])
        printf("%d ", min(b[i], a[j]));
      else
        printf("0 ");
    }
    printf("\n");
  }
  return 0;
}
