answers stored in ans.txt, shifts stored in shifts.txt