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 JAVA):

Solution:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DVasyaAndTheMatrix solver = new DVasyaAndTheMatrix();
        solver.solve(1, in, out);
        out.close();
    }

    static class DVasyaAndTheMatrix {
        int n;
        int m;
        int[] rows;
        int[] cols;

        public void readInput(Scanner sc) {
            n = sc.nextInt();
            m = sc.nextInt();
            rows = new int[n];
            cols = new int[m];
            for (int i = 0; i < n; i++)
                rows[i] = sc.nextInt();
            for (int i = 0; i < m; i++)
                cols[i] = sc.nextInt();
        }

        public void solve(int testNumber, Scanner sc, PrintWriter pw) {
            int q = 1;
            while (q-- > 0) {
                readInput(sc);
                boolean[][][] bits = new boolean[31][n][m];
                boolean f = true;
                for (int bit = 0; bit < 31; bit++) {
                    int c = 0;
                    boolean[] rowOdd = new boolean[n];
                    boolean[] colOdd = new boolean[m];
                    for (int i = 0; i < n; i++) {
                        if ((rows[i] & 1 << bit) != 0) {
                            c++;
                            rowOdd[i] = true;
                        }
                    }
                    int c2 = 0;
                    for (int i = 0; i < m; i++)
                        if ((cols[i] & 1 << bit) != 0) {
                            c2++;
                            colOdd[i] = true;
                        }
                    if (c2 % 2 != c % 2) {
                        f = false;
                        break;
                    }
                    if (c > c2) {
                        for (int i = 0; i < n; i++)
                            if (rowOdd[i]) {
                                for (int j = 0; j < m; j++) {
                                    if (colOdd[j]) {
                                        bits[bit][i][j] = true;
                                        colOdd[j] = false;
                                        rowOdd[i] = false;
                                        break;
                                    }
                                }
                            }
                        for (int i = 0; i < n; i++)
                            if (rowOdd[i]) {
                                bits[bit][i][0] = true;
                            }
                    } else {
                        for (int i = 0; i < m; i++)
                            if (colOdd[i]) {
                                for (int j = 0; j < n; j++) {
                                    if (rowOdd[j]) {
                                        bits[bit][j][i] = true;
                                        rowOdd[j] = false;
                                        colOdd[i] = false;
                                        break;
                                    }
                                }
                            }
                        for (int i = 0; i < m; i++)
                            if (colOdd[i])
                                bits[bit][0][i] = true;
                    }
                }
                int[][] ans = new int[n][m];
                for (int i = 0; i < n; i++)
                    for (int j = 0; j < m; j++)
                        for (int bit = 0; bit < 31; bit++)
                            if (bits[bit][i][j])
                                ans[i][j] |= 1 << bit;
                if (f) {
                    pw.println("YES");
                    for (int i = 0; i < n; i++) {
                        for (int j = 0; j < m; j++)
                            pw.print(ans[i][j] + " ");
                        pw.println();
                    }
                } else {
                    pw.println("NO");
                }
            }
        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() {
            try {
                while (st == null || !st.hasMoreTokens())
                    st = new StringTokenizer(br.readLine());
                return st.nextToken();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}