import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;

class Oct22 {
	public static void main(String[] args) {

		Scanner fin = null;

		try {
			File file = new File("matrix.txt");
			fin = new Scanner(file);
		}
		catch(FileNotFoundException e) {
			System.out.println(e);
			return;
		}
	
		int numRows = fin.nextInt();
		int numCols = fin.nextInt();

		System.out.printf("rows: %d cols: %d\n", numRows, numCols);	
		
		int[][] matrix = new int[numRows][numCols];

		for(int i = 0; i < numRows; i++) {
			for(int j = 0; j < numCols; j++) {
				matrix[i][j] = fin.nextInt();
			}
		}	
		printMatrix(matrix);
	
	}
	
	public static void printMatrix(int[][] m) {
		for(int i = 0; i < m.length; i++) {
			for(int j = 0; j < m[i].length; j++) {
				System.out.printf("%d ", m[i][j]);
			}
			System.out.println();
		}	
		System.out.println();
	}

}
