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