def mergeSort(alist):

    if len(alist) > 1:

        mid = len(alist)//2
        lS = mergeSort(alist[:mid])
        rS = mergeSort(alist[mid:])

        iL, iR, iW = 0, 0, 0

        while iL < len(lS) and iR < len(rS):

            if lS[iL] < rS[iR]:

                alist[iW] = lS[iL]
                iL += 1

            else:

                alist[iW] = rS[iR]
                iR += 1

            iW += 1

        if iL < len(lS):
            alist[iW:] = lS[iL:]
        else:
            alist[iW:] = rS[iR:]

    return alist

if __name__ == '__main__':
    uL = [54, 26, 93, 17, 77, 31, 44, 55, 20]
    sL = mergeSort(uL[:])
    print(uL)
    print(sL)