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.util.*;
import java.io.*;
import java.math.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
public class Hello {
  public static void main(String[] args) {
    //try {
    //  FileInputStream fis = new FileInputStream("data.txt");
    //  System.setIn(fis);
      //Scanner in = new Scanner(System.in);
      FastReader in = new FastReader(System.in);
      
      int n = in.nextInt();
      int m = in.nextInt();
      int []a = new int[n];
      int []b = new int[m];
      
      for (int i = 0;i < n;++i) a[i] = in.nextInt();
      for (int i = 0;i < m;++i) b[i] = in.nextInt();
      
      int [][]ans = new int[n][m];
      
      for (int z = 0;z < 32;++z) {
	
	int []aa = new int[n];
	int []bb = new int[m];
	for (int i = 0;i < n;++i) aa[i] = a[i] & (1<<z);
	for (int i = 0;i < m;++i) bb[i] = b[i] & (1<<z);
	int cnta = 0;
	int cntb = 0;
	for (int i = 0;i < n;++i) if (aa[i] > 0) cnta += 1;
	for (int i = 0;i < m;++i) if (bb[i] > 0) cntb += 1;
	//System.out.println("cnta:"+cnta);
	//System.out.println("cntb:"+cntb);
	if (cnta % 2 != cntb % 2) {
	  System.out.println("NO");
	  return;
	}
	if (cnta == 0 && cntb == 0) continue;
	if (cnta == 0 && cntb > 0) {
	  for (int j = 0;j < m;++j) {
	    if (bb[j] > 0) ans[0][j] ^= 1<<z;
	  }
	  continue;
	}
	if (cntb == 0 && cnta > 0) {
	  for (int j = 0;j < n;++j) {
	    if (aa[j] > 0) ans[j][0] ^= 1<<z;
	  }
	  continue;
	}
	
	int []aid = new int[cnta];
	int []bid = new int[cntb];
	int c = 0;
	for (int i = 0;i < n;++i) if (aa[i] != 0) aid[c++] = i;
	c = 0;
	for (int i = 0;i < m;++i) if (bb[i] != 0) bid[c++] = i;
	
	if (c % 2 == 1) {
	  for (int i = 0;i < cnta;++i) {
	    for (int j = 0;j < cntb;++j) {
	      int ii = aid[i];
	      int jj = bid[j];
	      ans[ii][jj] ^= 1<<z;
	    }
	  }
	} else {
	  if (cnta < cntb) {
	    for (int i = 0;i < cnta;++i) {
	      int ii = aid[i];
	      int jj = bid[i];
	      ans[ii][jj] ^= 1<<z;
	    }
	    for (int i = cnta;i < cntb;++i) {
	      int ii = aid[0];
	      int jj = bid[i];
	      ans[ii][jj] ^= 1<<z;
	    }
	  } else if (cnta >= cntb) {
	    for (int i = 0;i < cntb;++i) {
	      int ii = aid[i];
	      int jj = bid[i];
	      ans[ii][jj] ^= 1<<z;
	    }
	    for (int i = cntb;i < cnta;++i) {
	      int ii = aid[i];
	      int jj = bid[0];
	      ans[ii][jj] ^= 1<<z;
	    }
	  }
	}
      }
      
      System.out.println("YES");
      for (int i = 0;i < n;++i) {
	for (int j = 0;j < m;++j) {
	  System.out.print(ans[i][j] + " ");
	}
	System.out.println();
      }

      //for (int i = 0;i < n;++i) {
      //  int check = 0;
      //  for (int j = 0;j < m;++j) {
      //    check = check ^ ans[i][j];
      //  }
      //  System.out.print(check + " ");
      //}
      //for (int j = 0;j < m;++j) {
      //  int check = 0;
      //  for (int i = 0;i < n;++i) {
      //    check = check ^ ans[i][j];
      //  }
      //  System.out.print(check + " ");
      //}
      
      
      
    //} catch (FileNotFoundException e){
    //  System.out.println("error");
    //}
  }
}

class FastReader {
    private boolean finished = false;
 
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;
 
    public FastReader(InputStream stream) {
        this.stream = stream;
    }
 
    public int read() {
        if (numChars == -1) {
            throw new InputMismatchException();
        }
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0) {
                return -1;
            }
        }
 
        return buf[curChar++];
    }
 
    public int peek() {
        if (numChars == -1) {
            return -1;
        }
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                return -1;
            }
            if (numChars <= 0) {
                return -1;
            }
        }
        return buf[curChar];
    }
 
    public int nextInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c == ',') {
                c = read();
            }
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }
 
    public long nextLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }
 
    public String nextString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }
 
    public boolean isSpaceChar(int c) {
        if (filter != null) {
            return filter.isSpaceChar(c);
        }
        return isWhitespace(c);
    }
 
    public static boolean isWhitespace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }
 
    private String readLine0() {
        StringBuilder buf = new StringBuilder();
        int c = read();
        while (c != '\n' && c != -1) {
            if (c != '\r') {
                buf.appendCodePoint(c);
            }
            c = read();
        }
        return buf.toString();
    }
 
    public String nextLine() {
        String s = readLine0();
        while (s.trim().length() == 0)
            s = readLine0();
        return s;
    }
 
    public String nextLine(boolean ignoreEmptyLines) {
        if (ignoreEmptyLines) {
            return nextLine();
        } else {
            return readLine0();
        }
    }
 
    public BigInteger nextBigInteger() {
        try {
            return new BigInteger(nextString());
        } catch (NumberFormatException e) {
            throw new InputMismatchException();
        }
    }
 
    public char nextCharacter() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        return (char) c;
    }
 
    public double nextDouble() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        double res = 0;
        while (!isSpaceChar(c) && c != '.') {
            if (c == 'e' || c == 'E') {
                return res * Math.pow(10, nextInt());
            }
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        }
        if (c == '.') {
            c = read();
            double m = 1;
            while (!isSpaceChar(c)) {
                if (c == 'e' || c == 'E') {
                    return res * Math.pow(10, nextInt());
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                m /= 10;
                res += (c - '0') * m;
                c = read();
            }
        }
        return res * sgn;
    }
 
    public boolean isExhausted() {
        int value;
        while (isSpaceChar(value = peek()) && value != -1)
            read();
        return value == -1;
    }
 
    public String next() {
        return nextString();
    }
 
    public SpaceCharFilter getFilter() {
        return filter;
    }
 
    public void setFilter(SpaceCharFilter filter) {
        this.filter = filter;
    }
 
    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }
}