#include <bits/stdc++.h>
using namespace std;
long long hai[105][104];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long i, j, n, m, h, a[105], b[105];
  cin >> n >> m >> h;
  for (i = 0; i < m; i++) cin >> a[i];
  for (i = 0; i < n; i++) cin >> b[i];
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> hai[i][j];
      if (hai[i][j]) {
        hai[i][j] = min(a[j], b[i]);
      }
      cout << hai[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
