Recovering the alignment from the backpointers

After the iteration over the grid is finished, we need to go back and trace through the backpointers