import random

def number_guessing_game():
    # 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. Can you guess it?")
    
    while attempts > 0:
        guess = int(input("Enter your guess: "))
        
        if guess == secret_number:
            print("Congratulations! You guessed the number correctly!")
            break
        elif guess < secret_number:
            print("Too low! Try again.")
        else:
            print("Too high! Try again.")
        
        attempts -= 1
        print("Remaining attempts:", attempts)
    
    if attempts == 0:
        print("Sorry, you ran out of attempts. The correct number was", secret_number)
    
    play_again = input("Do you want to play again? (yes/no): ").lower()
    if play_again == "yes":
        number_guessing_game()
    else:
        print("Thanks for playing!")

# Start the game
number_guessing_game()
