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

Solution:
#!/usr/bin/python3

def pr(H, W, mtx, vec):
    for y in range(H):
        print(*[mtx[y][x] for x in range(W)], sep='', end=' ')
        print(vec[y])
    print()


def solveb(N, M, A, B, bit):
    mtx = [bytearray(N * M) for _ in range(N + M)]
    for m in range(M):
        for i in range(m, N * M, M):
            mtx[m][i] = 1

    for n in range(N):
        for i in range(M):
            mtx[M + n][n * M + i] = 1

    vec = bytearray(N + M)
    for m in range(M):
        vec[m] = (B[m] >> bit) & 1
    for n in range(N):
        vec[M + n] = (A[n] >> bit) & 1

    H = N + M
    W = N * M

    ox = 0
    bottomy = H
    for oy in range(H):
        # print(f'oy={oy} ox={ox}')
        # pr(H, W, mtx, vec)

        if ox == W:
            bottomy = oy
            break

        if mtx[oy][ox] == 0:
            while True:
                rep = False

                for y in range(oy + 1, H):
                    if mtx[y][ox] == 1:
                        row = mtx[oy]
                        mtx[oy] = mtx[y]
                        mtx[y] = row

                        v = vec[oy]
                        vec[oy] = vec[y]
                        vec[y] = v
                        break

                if mtx[oy][ox] == 0:
                    ox += 1
                    # print(f'ox={ox}')
                    if ox < W:
                        rep = True

                if not rep:
                    break

        if ox == W:
            bottomy = oy
            break

        for y in range(oy + 1, H):
            if mtx[y][ox] == 1:
                for x in range(ox, W):
                    mtx[y][x] ^= mtx[oy][x]
                vec[y] ^= vec[oy]

        ox += 1

    # print(f'bottomy={bottomy}')
    # pr(H, W, mtx, vec)

    for y in range(bottomy, H):
        if vec[y] == 1:
            return None

    for oy in range(bottomy - 1, -1, -1):
        ox = -1
        for x in range(0, W):
            if mtx[oy][x] == 1:
                ox = x
                break
        assert ox != -1

        # print(f'oy={oy} ox={ox}')
        # pr(H, W, mtx, vec)

        for y in range(oy):
            if mtx[y][ox] == 1:
                for x in range(W):
                    mtx[y][x] ^= mtx[oy][x]
                vec[y] ^= vec[oy]

    # pr(H, W, mtx, vec)

    ans = bytearray(N * M)
    for y in range(bottomy):
        ox = -1
        for x in range(W):
            if mtx[y][x] == 1:
                ox = x
                break
        assert ox != -1

        ans[ox] = vec[y]

    # print(f'ans={ans}')

    return ans


def solve(N, M, A, B):
    ans = [0] * (N * M)

    for bit in range(32):
        ansb = solveb(N, M, A, B, bit)

        if ansb is None:
            return None

        for i in range(N * M):
            ans[i] |= (ansb[i] << bit)

    result = [[0] * M for _ in range(N)]
    for y in range(N):
        for x in range(M):
            result[y][x] = ans[y * M + x]

    return result


def main():
    N, M = [int(e) for e in input().split(' ')]
    A = [int(e) for e in input().split(' ')]
    B = [int(e) for e in input().split(' ')]
    assert len(A) == N
    assert len(B) == M

    ans = solve(N, M, A, B)
    if ans is None:
        print('NO')
        return

    print('YES')
    for row in ans:
        print(*row)


if __name__ == '__main__':
    main()