#include <bits/stdc++.h>
using namespace std;
const int N = 1e2 + 5;
const double Pi = acos(-1);
const double e = exp(1.0);
const int mod = 1e9 + 7;
int n, m, h, F[N], L[N], U[N][N], ans[N][N];
int main() {
  cin >> n >> m >> h;
  for (int i = 1; i <= m; i++) {
    cin >> F[i];
    for (int j = 1; j <= n; j++) ans[j][i] = F[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> 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++) {
      cin >> U[i][j];
      if (!U[i][j]) ans[i][j] = 0;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cout << ans[i][j] << " \n"[j == m];
    }
  }
  return 0;
}
