#include <bits/stdc++.h>
using namespace std;
int nm[110][110];
int main() {
  int n, m, h;
  cin >> n >> m >> h;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      nm[i][j] = h;
    }
  }
  for (int i = 1; i <= m; i++) {
    int a;
    cin >> a;
    for (int j = 1; j <= n; j++) {
      nm[j][i] = min(a, nm[j][i]);
    }
  }
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    for (int j = 1; j <= m; j++) {
      nm[i][j] = min(a, nm[i][j]);
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      bool a;
      cin >> a;
      if (!a) {
        nm[i][j] = 0;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cout << nm[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
