#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int q, w, e, r, t, y, u, n, m, h;
  int na[100], ma[100];
  cin >> n >> m >> h;
  int z = n;
  int x = m;
  long long int arr[n][m];
  for (int i = 0; i < m; i++) {
    cin >> ma[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> na[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> arr[i][j];
      if (arr[i][j]) {
        if (ma[j] || na[i]) {
          arr[i][j] = min(ma[j], na[i]);
        }
      }
      cout << arr[i][j] << "     ";
    }
    cout << "\n";
  }
}
