#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, h;     cin >> n >> m >> h;     int f[m];     int l[n];     int t[n][m];     int ans[n][m];     for (int i = 0; i < m; i++) cin >> f[i];     for (int i = 0; i < n; i++) cin >> l[i];     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) {         cin >> t[i][j];         if (t[i][j] == 1) {           ans[i][j] = 1;         }       }     memset(ans, 0, sizeof(ans));     for (int i = 0; i < m; i++) {       int h1 = f[i];       for (int j = 0; j < n; j++) {         if (t[j][i] == 1 && l[j] >= h1) {           ans[j][i] = h1;         }       }     }     for (int i = 0; i < n; i++) {       int h1 = l[i];       for (int j = 0; j < m; j++) {         if (t[i][j] == 1 && f[j] >= h1) {           ans[i][j] = h1;         }       }     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         cout << ans[i][j] <<    ;       }       cout << endl;     }   }   