#include <bits/stdc++.h>
using namespace std;
int a[100], b[100], c[100][100];
int main() {
  int n, m, h;
  cin >> n >> m >> h;
  for (int i = 0; i < m; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> c[i][j];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      if (c[i][j] != 0)
        if (a[j] < b[i]) {
          if (c[i][j] < a[j]) c[i][j] = a[j];
        } else {
          if (c[i][j] < a[j]) c[i][j] = b[i];
        }
    }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (j == (m - 1))
        cout << c[i][j];
      else
        cout << c[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
