#include <bits/stdc++.h>
using namespace std;
const int maxn = 100;
int n, m, h;
int front[maxn], _left[maxn], top[maxn][maxn];
int ans[maxn][maxn];
int main() {
  scanf("%d%d%d", &n, &m, &h);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) ans[i][j] = 100;
  for (int j = 0; j < m; j++) {
    scanf("%d", &_left[j]);
    for (int i = 0; i < n; i++) ans[i][j] = min(ans[i][j], _left[j]);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &front[i]);
    for (int j = 0; j < m; j++) ans[i][j] = min(ans[i][j], front[i]);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%d", &top[i][j]);
      if (top[i][j] == 0) ans[i][j] = 0;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) printf("%d ", ans[i][j]);
    printf("\n");
  }
  return 0;
}
