#include <bits/stdc++.h>
using namespace std;
int n, m, h;
int A[103], B[103];
int pet[103][103];
int main() {
  scanf("%d %d %d", &n, &m, &h);
  for (int i = 1; i <= m; i++) scanf("%d", &B[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &A[i]);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%d", &pet[i][j]);
      if (pet[i][j]) pet[i][j] = min(A[i], B[j]);
      printf("%d%c", pet[i][j], (j == m) ? '\n' : ' ');
    }
  }
}
