#include <bits/stdc++.h>
using namespace std;
void print(vector<bool> v) {
  for (auto x : v) cout << x << " ";
  puts("");
}
int grid[101][101], ans[101][101];
int main() {
  int n, m, h;
  cin >> n >> m >> h;
  vector<int> hm(m), hn(n);
  for (int i = 0; i < m; i++) cin >> hm[i];
  for (int i = 0; i < n; i++) cin >> hn[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> grid[i][j];
  for (int j = 0; j < m; j++) {
    for (int i = 0; i < n; i++) {
      ans[i][j] = hm[j];
    }
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      if (ans[i][j] = min(hn[i], ans[i][j]))
        ;
      if (!grid[i][j]) ans[i][j] = 0;
    }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << ans[i][j] << " ";
    }
    puts("");
  }
  return 0;
}
