#include <bits/stdc++.h>
using namespace std;
int n, m, h;
int bb[109][109][109];
int a[109], b[109], c[109][109];
int main() {
  scanf("%d%d%d", &n, &m, &h);
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      for (int k = 1; k <= h; k++) {
        bb[i][j][k] = 1;
      }
    }
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d", &a[i]);
    for (int j = 1; j <= n; j++) {
      for (int k = a[i] + 1; k <= h; k++) {
        bb[i][j][k] = 0;
      }
    }
  }
  for (int j = 1; j <= n; j++) {
    scanf("%d", &b[j]);
    for (int i = 1; i <= m; i++) {
      for (int k = b[j] + 1; k <= h; k++) {
        bb[i][j][k] = 0;
      }
    }
  }
  for (int j = 1; j <= n; j++) {
    for (int i = 1; i <= m; i++) {
      scanf("%d", &c[i][j]);
      if (c[i][j] == 0) {
        for (int k = 1; k <= h; k++) bb[i][j][k] = 0;
      }
    }
  }
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      for (int k = 2; k <= h; k++) {
        if (bb[i][j][k]) bb[i][j][1]++;
      }
    }
  }
  for (int j = 1; j <= n; j++) {
    for (int i = 1; i <= m; i++) {
      printf("%d ", bb[i][j][1]);
    }
    printf("\n");
  }
}
