# include <bits/stdc++.h>
using namespace std;
const int N = 10;
const int M = 10000;
int main() {
	random_device rand;
	int	n = rand() % N + 1, 
		m = rand() % M + 1;
	printf("%d %d\n", n, m);
	for (int i = 1; i <= n; i ++) {
		for (int j = 1; j <= m; j ++) {
			int x = rand() & 3;
			printf("%d ", x);
		}
		puts("");
	}
	return 0;
}
