#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long N, M, x;
  vector<long> Front, Left;
  vector<vector<long>> Height;
  cin >> N >> M >> x;
  Front.resize(M);
  Left.resize(N);
  Height.resize(N, vector<long>(M));
  for (long i = 0; i < M; ++i) cin >> Front[i];
  for (long i = 0; i < N; ++i) cin >> Left[i];
  for (long i = 0; i < N; ++i) {
    for (long j = 0; j < M; ++j) {
      cin >> Height[i][j];
      if (Height[i][j] == 0) continue;
      Height[i][j] = min(Front[j], Left[i]);
    }
  }
  for (long i = 0; i < N; ++i) {
    for (long j = 0; j < M; ++j) cout << Height[i][j] << ' ';
    cout << endl;
  }
  return 0;
}
