Through all the elements of a two-dimensional array