Snake sequence problem