Allocated and deallocated grid. Printing for grid.