#include <bits/stdc++.h>
using namespace std;
int a[105];
int b[105];
int w[105][105];
int main() {
  int n, m, h;
  cin >> n >> m >> h;
  for (int i = 0; i < m; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) scanf("%d", &b[i]);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf("%d", &w[i][j]);
  cout << endl;
  for (int i = 0; i < n; i++, cout << endl)
    for (int j = 0; j < m; j++) {
      if (w[i][j] == 0)
        cout << 0 << " ";
      else {
        cout << min(b[i], a[j]) << " ";
      }
    }
  return 0;
}
