Circus.py Time:O(nlogn) Space:O(n)