#include <bits/stdc++.h>
using namespace std;
int arr[100005], x;
void rot(int a, int b) {
  int t = arr[b];
  for (int i = b - 1; i >= a; i--) arr[i + 1] = arr[i];
  arr[a] = t;
}
int bin(int l, int r) {
  if (l <= r) {
    int m = l + (r - l) / 2;
    if (arr[m] == x)
      return m;
    else if (arr[l] < arr[m]) {
      if (x >= arr[l] && x <= arr[m]) return bin(l, m - 1);
      return bin(m + 1, r);
    } else {
      if (x >= arr[m] && x <= arr[r]) return bin(m + 1, r);
      return bin(l, m - 1);
    }
  }
  return -1;
}
int pivot(int l, int r) {
  if (l > r)
    return arr[0];
  else {
    int m = l + (r - l) / 2;
    if (m < r && arr[m] > arr[m + 1])
      return arr[m + 1];
    else if (m > l && arr[m - 1] > arr[m])
      return arr[m];
    else if (arr[l] >= arr[m])
      return pivot(l, m - 1);
    else
      return pivot(m + 1, r);
  }
}
void rev(int a, int b) {
  while (a < b) {
    swap(arr[a], arr[b]);
    ++a;
    --b;
  }
}
int n;
int part() {
  int i = -1;
  for (int j = 0; j < n; j++) {
    if (arr[j] < 0) {
      ++i;
      swap(arr[i], arr[j]);
    }
  }
  return i + 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, h, i, j;
  int arr1[105], arr2[105], arr3[105][105], arr[105][105];
  cin >> n >> m >> h;
  for (i = 0; i < m; i++) {
    cin >> arr1[i];
    for (j = 0; j < n; j++) arr[j][i] = arr1[i];
  }
  for (i = 0; i < n; i++) {
    cin >> arr2[i];
    for (j = 0; j < m; j++) arr[i][j] = min(arr[i][j], arr2[i]);
  }
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++) {
      cin >> arr3[i][j];
      if (arr3[i][j] == 0) arr[i][j] = 0;
    }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) cout << arr[i][j] << " ";
    cout << "\n";
  }
}
