Problem: Now Vasya is taking an exam in mathematics. In order to get a good mark, Vasya needs to guess the matrix that the teacher has constructed!

Vasya knows that the matrix consists of n rows and m columns. For each row, he knows the xor (bitwise excluding or) of the elements in this row. The sequence a1, a2, ..., an denotes the xor of elements in rows with indices 1, 2, ..., n, respectively. Similarly, for each column, he knows the xor of the elements in this column. The sequence b1, b2, ..., bm denotes the xor of elements in columns with indices 1, 2, ..., m, respectively.

Help Vasya! Find a matrix satisfying the given constraints or tell him that there is no suitable matrix.

Input

The first line contains two numbers n and m (2 ≤ n, m ≤ 100) — the dimensions of the matrix.

The second line contains n numbers a1, a2, ..., an (0 ≤ ai ≤ 109), where ai is the xor of all elements in row i.

The third line contains m numbers b1, b2, ..., bm (0 ≤ bi ≤ 109), where bi is the xor of all elements in column i.

Output

If there is no matrix satisfying the given constraints in the first line, output "NO".

Otherwise, on the first line output "YES", and then n rows of m numbers in each ci1, ci2, ... , cim (0 ≤ cij ≤ 2·109) — the description of the matrix.

If there are several suitable matrices, it is allowed to print any of them.

Examples

Input

2 3
2 9
5 3 13


Output

YES
3 4 5
6 7 8


Input

3 3
1 7 6
2 15 12


Output

NO

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
const static long long INF = std::numeric_limits<int>::max();
struct DinicFlow {
  struct edge {
    long long a, b;
    long long flow, cap;
    edge* rev;
    edge(const long long& _a, const long long& _b, const long long& _flow,
         const long long& _cap, edge* _rev = nullptr)
        : a(_a), b(_b), flow(_flow), cap(_cap), rev(_rev) {}
  };
  typedef std::vector<std::vector<edge*>> adj_list;
  std::vector<char> blocked;
  std::vector<long long> distances;
  adj_list graph;
  long long n;
  long long source;
  long long sink;
  DinicFlow(const long long& _n) : n(_n) {
    source = n++;
    sink = n++;
    blocked.assign(n, false);
    distances.assign(n, INF);
    graph.assign(n, std::vector<edge*>());
  }
  ~DinicFlow(void) {
    for (auto& row : graph) {
      for (auto& e : row) {
        delete e;
      }
    }
  }
  edge* add_edge(const long long& a, const long long& b, const long long& cap,
                 const long long& flow = 0) {
    edge* normal = new edge(a, b, flow, cap);
    edge* reverse = normal->rev = new edge(b, a, 0, 0, normal);
    graph[a].push_back(normal);
    graph[b].push_back(reverse);
    if (!normal || !reverse) {
      std::fprintf(stderr, "fail\n");
    }
    return normal;
  }
  bool bfs(void) {
    distances.assign(n, INF);
    distances[sink] = 0;
    std::queue<long long> order;
    order.push(sink);
    while (!order.empty()) {
      long long best = order.front();
      order.pop();
      if (best == source) return true;
      for (edge* neigh : graph[best]) {
        if (neigh->rev->cap > neigh->rev->flow &&
            distances[neigh->b] > 1 + distances[best]) {
          distances[neigh->b] = 1 + distances[best];
          order.push(neigh->b);
        }
      }
    }
    return false;
  }
  long long dfs(const long long& pos, const long long& min) {
    if (pos == sink) {
      return min;
    }
    long long flow = 0;
    for (edge* e : graph[pos]) {
      long long curr = 0;
      if (!blocked[e->b] && distances[e->b] == distances[pos] - 1 &&
          e->cap > e->flow) {
        curr = dfs(e->b, std::min(min - flow, e->cap - e->flow));
        e->flow += curr;
        e->rev->flow = -(e->flow);
        flow += curr;
      }
      if (flow == min) return flow;
    }
    blocked[pos] = flow != min;
    return flow;
  }
  long long flow(void) {
    long long ret = 0;
    while (bfs()) {
      blocked.assign(blocked.size(), false);
      ret += dfs(source, INF);
    }
    return ret;
  }
};
std::string row, col;
void doit(const long long& bit, std::vector<std::vector<int>>& matrix) {
  const long long r = row.length();
  const long long c = col.length();
  DinicFlow myflow(r + c);
  const long long all_ones_row = r % 2;
  const long long all_ones_col = c % 2;
  std::vector<DinicFlow::edge*> va;
  int sum = 0;
  for (long long i = 0; i < r; ++i) {
    if (all_ones_col) {
      if (row[i] == '1') {
        auto it = myflow.add_edge(myflow.source, i, c);
        va.push_back(it);
        sum += c;
      } else {
        auto it = myflow.add_edge(myflow.source, i, c - 1);
        va.push_back(it);
        sum += c - 1;
      }
    } else {
      if (row[i] == '1') {
        auto it = myflow.add_edge(myflow.source, i, c - 1);
        sum += c - 1;
      } else {
        auto it = myflow.add_edge(myflow.source, i, c);
        va.push_back(it);
        sum += c;
      }
    }
  }
  int sumc = 0;
  for (long long i = 0; i < c; ++i) {
    if (all_ones_row) {
      if (col[i] == '1') {
        myflow.add_edge(i + r, myflow.sink, r);
        sumc += r;
      } else {
        myflow.add_edge(i + r, myflow.sink, r - 1);
        sumc += r - 1;
      }
    } else {
      if (col[i] == '1') {
        myflow.add_edge(i + r, myflow.sink, r - 1);
        sumc += r - 1;
      } else {
        myflow.add_edge(i + r, myflow.sink, r);
        sumc += r;
      }
    }
  }
  std::vector<std::vector<DinicFlow::edge*>> edges(
      r, std::vector<DinicFlow::edge*>(c));
  for (long long i = 0; i < r; ++i) {
    for (long long j = 0; j < c; ++j) {
      edges[i][j] = myflow.add_edge(i, j + r, 1);
    }
  }
  if (std::min(sum, sumc) != myflow.flow()) {
    exit(0);
  }
  for (long long i = 0; i < r; ++i) {
    for (long long j = 0; j < c; ++j) {
      if (edges[i][j]->flow) matrix[i][j] ^= (1 << bit);
    }
  }
}
long long a[101], b[101];
int main(void) {
  long long n, m;
  std::cin >> n >> m;
  for (long long i = 0; i < n; ++i) {
    std::cin >> a[i];
  }
  for (long long i = 0; i < m; ++i) {
    std::cin >> b[i];
  }
  row = std::string(n, '0');
  col = std::string(m, '0');
  std::vector<std::vector<int>> matrix(n, std::vector<int>(m));
  for (long long bit = 0; bit < 30; ++bit) {
    for (long long i = 0; i < n; ++i)
      if (a[i] & (1 << bit)) {
        row[i] = '1';
      } else {
        row[i] = '0';
      }
    for (long long i = 0; i < m; ++i)
      if (b[i] & (1 << bit)) {
        col[i] = '1';
      } else {
        col[i] = '0';
      }
    doit(bit, matrix);
  }
  bool good = true;
  for (long long i = 0; i < n; ++i) {
    long long tmp = 0;
    for (long long j = 0; j < m; ++j) tmp ^= matrix[i][j];
    good = good && tmp == a[i];
  }
  for (long long j = 0; j < m; ++j) {
    long long tmp = 0;
    for (long long i = 0; i < n; ++i) tmp ^= matrix[i][j];
    good = good && tmp == b[j];
  }
  if (!good) {
    std::cout << "NO\n";
    return 0;
  } else {
    std::cout << "YES\n";
    for (const auto& e : matrix) {
      for (const auto& eee : e) std::cout << eee << " ";
      std::cout << "\n";
    }
  }
  return 0;
}