#include <bits/stdc++.h>
using namespace std;
int n, m, h;
int a[110];
int b[110];
int t[110][110];
int ans[110][110];
int main() {
  scanf("%d%d%d", &n, &m, &h);
  for (int i = 1; i <= m; i++) scanf("%d", &(a[i]));
  for (int i = 1; i <= n; i++) scanf("%d", &(b[i]));
  for (int r = 1; r <= n; r++)
    for (int c = 1; c <= m; c++) scanf("%d", &(t[r][c]));
  for (int r = 1; r <= n; r++)
    for (int c = 1; c <= m; c++) {
      if (t[r][c] == 1) {
        int d = a[c];
        if (d > b[r]) d = b[r];
        ans[r][c] = d;
      } else {
        ans[r][c] = 0;
      }
    }
  for (int r = 1; r <= n; r++) {
    for (int c = 1; c <= m; c++) printf("%d ", ans[r][c]);
    printf("\n");
  }
  return 0;
}
