def classify_train_number(train_number: int) -> dict:
    last_digit = train_number % 10

    direction = "up" if last_digit % 2 == 1 else "down"

    if last_digit in (1, 2):
        train_type = "regular"
    elif last_digit in (3, 4):
        train_type = "deadhead"
    elif last_digit in (5, 6):
        train_type = "test"
    elif last_digit in (7, 8):
        train_type = "short_turn"
    elif last_digit == 9:
        train_type = "temporary"
        direction = "up"
    else:
        train_type = "unknown"

    return {
        "train_number": train_number,
        "type": train_type,
        "direction": direction
    }
