I need some help with a project. I'm trying to print out all possible combinations of a number grid.

For example:

1 3 2 5 4

2 4 3 1 5

5 3 4 2 3

4 3 1 5 2

5 3 4 1 2

The numbers are randomly generated. You start at the top of each column and then can either move down or diagonally down until you reach the bottom of any column. I need to find all of the possible number combinations. I'm stumped, any ideas?

The numbers would probably be passed into the function as an array of nodes. And these nodes contain pointers to each of its 3 childs (center, left, and right) and its respective int value.