def clamp(x, lo, hi):
    return max(lo, min(x, hi))
assert clamp(5, 1, 10) == 5
assert clamp(-1, 0, 10) == 0
assert clamp(11, 0, 10) == 10
print("SELF-TEST PASS")