Today HH is palying with a n×n matrix.
All the numbers of the matrix is 0 initial, and every time HH will do one of the following things:
1.make all the numbers in the k row become v
2.make all the numbers in the k column become v
Now HH wants to know what's the final matrix after q options.
输入描述:
The first line contains an positive integer T(1≤T≤10), represents there are T test cases.
For each test case:
The first line contains two positive integers n,q(1≤n≤500,1≤q≤2*105) - the size of the matrix and the times of the options.
Then q lines following, for each line contains three integers op,k,v(1≤op≤2,1≤k≤n,1≤v≤100).
if op=1, then HH will change all the numbers in the k row into v
if op=2, then HH will change all the numbers in the k column into v
输出描述:
For each test case, you should output n lines , each line n numbers , indicating the final matrix, note that for each line ,you should print exactly one blank between two numbers.