generate all possible final grids