Fixed transposing and printing of N by M matrix