#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, h;
  cin >> n >> m >> h;
  vector<vector<int> > ans(n, vector<int>(m, h));
  for (int i = 0; i < m; i++) {
    int t;
    cin >> t;
    for (int j = 0; j < n; j++) {
      ans[j][i] = min(ans[j][i], t);
    }
  }
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    for (int j = 0; j < m; j++) {
      ans[i][j] = min(ans[i][j], t);
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int t;
      cin >> t;
      if (t == 0) {
        ans[i][j] = 0;
      }
    }
  }
  for (auto i : ans) {
    for (auto j : i) {
      cout << j << " ";
    }
    cout << endl;
  }
  return 0;
}
