#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     cout.precision(10);     int n;     cin >> n;     int m;     cin >> m;     std::vector<std::vector<long long> > re(n, std::vector<long long>(m, 0));     long long ta = 0;     for (int i = 0; i < n; ++i) {       cin >> re[i][0];       ta ^= re[i][0];     }     long long tb = 0;     long long a;     for (int i = 0; i < m; ++i) {       cin >> a;       re[0][i] ^= a;       tb ^= a;     }     if (tb != ta) {       cout <<  NO ;       exit(0);     }     re[0][0] ^= ta;     cout <<  YES n ;     for (int i = 0; i < n; ++i)       for (int j = 0; j < m; ++j) cout << re[i][j] <<   n  [j != m - 1];   }   