#include <bits/stdc++.h>
using namespace std;
int a[105], b[105], c[105][105];
int main() {
  int n, m, h;
  cin >> n >> m >> h;
  for (int i = 1; i <= m; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      cin >> c[j][i];
      if (c[j][i] == 1) {
        c[j][i] = min(a[j], b[i]);
      }
    }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cout << c[j][i] << ' ';
    }
    cout << endl;
  }
}
