def merge(left, right):
    """Merge two sorted list to one sorted list"""
    res = []
    p1, p2 = 0, 0

    while True:
        if p1 == len(left):
            res.extend(right[p2:])
            break
        elif p2 == len(right):
            res.extend(left[p1:])
            break

        elif left[p1] < right[p2]:
            res.append(left[p1])
            p1 += 1
        else:
            res.append(right[p2])
            p2 += 1

    return res