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