#include <stdio.h>
#include <stdlib.h>

int
main()
{	
	int lenght, width;
	scanf("%d %d", &lenght, &width);	

	char **string = (char **)malloc(sizeof(char *) * width);
	
	if(string){
		printf("Allocated string!\n");
	}else{
		printf("Malloc failed!\n");
		return 1;
	}

	for(int i = 0; i < width; i++){
		string[i] = (char *)malloc(sizeof(char) * lenght);
		if(!string){
			printf("Malloc %d failed!\n", i);
		return 1;
		}
	}
	
	for(int i = 0; i < width; i++)
		free(string[i]);

	free(string);
	return 0;
}
