#include <stdio.h>

int k, n;

int main()
{
	scanf("%d %d", &k, &n);
	printf("%d\n%d\n", k, n);

	int i, j, h, x;
	for (i = 1; i <= n; i++) {
		scanf("%d", &h);
		printf("%d",h);
		for (j = 1; j <= h; j++) {
			scanf("%d", &x);
			printf(" %d", x);
		}
		printf("\n");
	}
		
	return 0;
}
