def cmp(a, b):
    """Compare two numbers A and B, and return 1, 0, and -1 when A > B, A = B,
    and A < B, respectively."""
    if a > b:
        return 1
    elif a < b:
        return -1
    else:
        return 0
