#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e2 + 10;
int n, m, h;
int a[MAXN], b[MAXN], ans[MAXN][MAXN];
void pt() {
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      j == m ? printf("%d\n", ans[i][j]) : printf("%d ", ans[i][j]);
    }
  }
}
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) {
    for (int j = 1; j <= m; ++j) {
      ans[i][j] = a[j];
    }
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &b[i]);
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      ans[i][j] = min(ans[i][j], b[i]);
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      int num;
      scanf("%d", &num);
      if (num == 0) {
        ans[i][j] = 0;
      }
    }
  }
  pt();
  return 0;
}
