#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, h;
  cin >> n >> m >> h;
  int l[m], r[n], t[n][m];
  for (int i = 0; i < m; i++) {
    cin >> l[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> r[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> t[i][j];
    }
  }
  for (int j = 0; j < m; j++) {
    for (int i = 0; i < n; i++) {
      if (l[j] <= r[i]) {
        t[i][j] = t[i][j] * l[j];
      } else {
        t[i][j] = t[i][j] * r[i];
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << t[i][j] << " ";
    }
    cout << endl;
  }
}
