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.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayDeque;

public class D {

	static int R,C;
	static long xR[], xC[];
	static long b[][];
	public static void main(String[] args) {
		JS in = new JS();//
		PrintWriter out = new PrintWriter(System.out);
		R = in.nextInt();
		C = in.nextInt();
		xR = new long[R];
		xC = new long[C];
		for(int i = 0; i < R; i++) xR[i] = in.nextLong();
		for(int i = 0; i < C; i++) xC[i] = in.nextLong();
		b = new long[R][C];
		
		boolean good = true;
		for(int bit = 0; bit <= 30; bit++) {
			int eR = 0;
			int oR = 0;
			int eC = 0;
			int oC = 0;
			for(int i = 0; i < R; i++) {
				if( (xR[i]&(1L<<bit)) > 0 ) oR++;
				else eR++;
			}
			for(int i = 0; i < C; i++) {
				if( (xC[i]&(1L<<bit)) > 0 ) oC++;
				else eC++;
			}
			
			if(oR%2 != oC%2) {
				good = false;
				break;
			}
			
			boolean usedR[] = new boolean[R];
			boolean usedC[] = new boolean[C];
			//Match all odds to other odds
			for(int r = 0; r < R; r++) {
				if((xR[r]&(1L<<bit)) == 0)continue;
				for(int c = 0; c < C; c++) {
					if(usedR[r] || usedC[c])continue;
					if((xC[c]&(1L<<bit)) == 0)continue;					
					usedR[r]=true;
					usedC[c]=true;
					oR--;
					oC--;
					xR[r] -= (1L<<bit);
					xC[c] -= (1L<<bit);
					b[r][c] += (1L<<bit);				
				}
			}
			
			if(oR == 0 && oC == 0) continue;
			else {
				if(oR > 0) { //go through columns and match even to oR
					ArrayDeque<Integer> oddRows = new ArrayDeque<Integer>();
					for(int r = 0; r < R; r++) {
						if(usedR[r])continue;
						if((xR[r] & (1L<<bit)) > 0) oddRows.add(r);
					}
					for(int c = 0; c < C; c++) {
						if((xC[c]&(1L<<bit)) == 0) { //if even
							int r1 = oddRows.poll();
							int r2 = oddRows.poll();
							b[r1][c]+=(1L<<bit);
							b[r2][c]+=(1L<<bit);
							c--;
							if(oddRows.isEmpty())break;
						}
					}				
					
				}
				else { 	//go through rows and match even to oR
					ArrayDeque<Integer> oddCols = new ArrayDeque<Integer>();
					for(int c = 0; c < C; c++) {
						if(usedC[c])continue;
						if((xC[c] & (1L<<bit)) > 0) oddCols.add(c);
					}
					for(int r = 0; r < R; r++) {
						if((xR[r]&(1L<<bit)) == 0) { //if even
							int c1 = oddCols.poll();
							int c2 = oddCols.poll();
							b[r][c1]+=(1L<<bit);
							b[r][c2]+=(1L<<bit);
							r--;
							if(oddCols.isEmpty())break;
						}
					}
					
				}
				
				
			}
			
			
		}
		if(good) {
			out.println("YES");
			for(int i = 0; i < R; i++) {
				for(int j = 0; j < C; j++) {
					out.print(b[i][j]+" ");
				}out.println();
			}
		}
		else {
			out.println("NO");
		}
		out.close();
		

	}

	
	static class JS{
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;
		
		public JS() {
			in = new BufferedInputStream(System.in, BS);
		}
		
		public JS(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}
		
		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}				
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}
		
		public int nextInt() {
			return (int)nextLong();
		}
		
		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}
		
		public double nextDouble() {
		    while(c!='.'&&c!='-'&&(c <'0' || c>'9')) c = nextChar();
		    boolean neg = c=='-';
		    if(neg)c=nextChar();
		    boolean fl = c=='.';
		    double cur = nextLong();
		    if(fl) return neg ? -cur/num : cur/num;
		    if(c == '.') {
			double next = nextLong();
			return neg ? -cur-next/num : cur+next/num;
		    }
		    else return neg ? -cur : cur;
		}
		
		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}
		
		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
	}
	
}