records = []

while True:
    print("\n===== Hotel Reservation System =====")
    print("1. Add Record")
    print("2. View All Records")
    print("3. Search Record")
    print("4. Update Record")
    print("5. Delete Record")
    print("6. Exit")

    choice = input("Please choose an option: ")

    if choice == "1":
        if len(records) >= 100:
            print("Cannot add more items. Storage is full.")
            continue
        record = {}
        record["room"] = int(input("Enter Room Number: "))
        record["guest"] = input("Enter Guest Name: ")
        record["nights"] = int(input("Enter Nights: "))
        records.append(record)
        print("Added successfully!")

    elif choice == "2":
        if len(records) == 0:
            print("No Records Found.")
        else:
            print("\n===== Records (Room Number | Guest Name | Nights) =====")
            for i, record in enumerate(records):
                print(f"{i + 1}. " + str(record["room"]) + " | " + str(record["guest"]) + " | " + str(record["nights"]))

    elif choice == "3":
        key = int(input("Enter Room Number to Search: "))
        found = False
        for record in records:
            if record["room"] == key:
                print("Found: " + str(record["room"]) + " | " + str(record["guest"]) + " | " + str(record["nights"]))
                found = True
        if not found:
            print("No matching record was found.")

    elif choice == "4":
        key = int(input("Enter Room Number to Update: "))
        found = False
        for i in range(len(records)):
            if records[i]["room"] == key:
                records[i]["room"] = int(input("Enter New Room Number: "))
                records[i]["guest"] = input("Enter New Guest Name: ")
                records[i]["nights"] = int(input("Enter New Nights: "))
                print("Updated successfully!")
                found = True
                break
        if not found:
            print("No matching record was found.")

    elif choice == "5":
        key = int(input("Enter Room Number to Delete: "))
        found = False
        for i in range(len(records)):
            if records[i]["room"] == key:
                records.pop(i)
                print("Deleted successfully!")
                found = True
                break
        if not found:
            print("No matching record was found.")

    elif choice == "6":
        print("Thank You for Using Hotel Reservation System.")
        break

    else:
        print("Invalid Choice.")