from typing import Union


def try_num(s: str) -> Union[str, float, int]:
    """Attempt to convert a string to an integer. If that fails, try a float.
    If that fails, leave it as a string and return it."""

    try:
        return int(s)
    except ValueError:
        try:
            return float(s)
        except ValueError:
            return s