Does this work for square one? I suspect you won't be able to find the inverse of (1, 0), since (-1, 0) is not a move you can apply to a solved sq1.