#include <bits/stdc++.h>
using namespace std;
int a[105][105][105];
int ans[105][105];
int main() {
  int n, m, h, x;
  cin >> n >> m >> h;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      for (int k = 1; k <= h; k++) a[i][j][k] = 1;
  for (int i = 1; i <= m; i++) {
    cin >> x;
    for (int j = x + 1; j <= h; j++)
      for (int k = 1; k <= n; k++) a[k][i][j] = 0;
  }
  for (int i = 1; i <= n; i++) {
    cin >> x;
    for (int j = x + 1; j <= h; j++)
      for (int k = 1; k <= m; k++) a[i][k][j] = 0;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      cin >> x;
      if (x == 0)
        for (int k = 1; k <= h; k++) a[i][j][k] = 0;
    }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      ans[i][j] = 0;
      for (int k = 1; k <= h; k++)
        if (a[i][j][k]) ans[i][j]++;
    }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      cout << ans[i][j];
      if (j == m)
        cout << endl;
      else
        cout << " ";
    }
  return 0;
}
