#include <bits/stdc++.h>
using namespace std;
const long long MAX = 101;
long long mat[MAX][MAX], ans[MAX][MAX], arr1[MAX], arr2[MAX];
int main() {
  long long n, m, h;
  cin >> n >> m >> h;
  for (long long i = 0; i < m; i++) cin >> arr2[i];
  for (long long i = 0; i < n; i++) cin >> arr1[i];
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++) cin >> mat[i][j];
  for (long long i = 0; i < m; i++) {
    for (long long j = 0; j < n; j++)
      if (arr2[i] <= arr1[j] && mat[j][i]) {
        ans[j][i] = arr2[i];
        break;
      }
  }
  for (long long j = 0; j < n; j++) {
    for (long long i = 0; i < m; i++)
      if (arr1[j] <= arr2[i] && mat[j][i] && !ans[j][i]) {
        ans[j][i] = arr1[j];
        break;
      }
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      if (mat[i][j] && !ans[i][j])
        cout << 1 << ' ';
      else
        cout << ans[i][j] << ' ';
    }
    cout << '\n';
  }
}
