Convert between integers (1 to 3999) and Roman numerals, using subtractive notation (IV = 4, XC = 90, CM = 900).
Implement to_roman(n) and from_roman(s). from_roman must reject invalid numerals such as "IIII", "VX" or "IC" with a ValueError. A neat trick: convert, then check that converting back gives the same string. to_roman raises ValueError outside 1–3999.