import random

def guess_number():
    # Generate a random number between 1 and 100
    secret_number = random.randint(1, 100)
    attempts = 5  # Number of attempts allowed
    print("Welcome to the Number Guessing Game!")
    print("I'm thinking of a number between 1 and 100.")

    while attempts > 0:
        print("\nYou have", attempts, "attempts left.")
        guess = int(input("Guess the number: "))

        if guess < secret_number:
            print("Too low! Try guessing a higher number.")
        elif guess > secret_number:
            print("Too high! Try guessing a lower number.")
        else:
            print("Congratulations! You've guessed the number correctly:", secret_number)
            return True

        attempts -= 1

    print("\nSorry, you've run out of attempts.")
    print("The number I was thinking of was:", secret_number)
    return False

def main():
    while True:
        if guess_number():
            print("You won!")
        else:
            print("You lost!")
        
        play_again = input("Do you want to play again? (yes/no): ").lower()
        if play_again != 'yes':
            break

if __name__ == "__main__":
    main()