#include <bits/stdc++.h>
using namespace std;
int a[102][102];
int A[102], B[102];
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 >> a[i][j];
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (a[i][j]) {
        a[i][j] = max(1, min(B[i], A[j]));
      }
    }
  }
  for (int i = 0; i < n; ++i, cout << endl)
    for (int j = 0; j < m; ++j) cout << a[i][j] << " ";
}
