Spiral Scan, be careful edge cases, AC