records = []

while True:
    print("\n===== Invoice Generator =====")
    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["item"] = input("Enter Item: ")
        record["qty"] = int(input("Enter Quantity: "))
        record["price"] = float(input("Enter Unit Price: "))
        records.append(record)
        print("Added successfully!")

    elif choice == "2":
        if len(records) == 0:
            print("No Records Found.")
        else:
            print("\n===== Records (Item | Quantity | Unit Price) =====")
            for i, record in enumerate(records):
                print(f"{i + 1}. " + str(record["item"]) + " | " + str(record["qty"]) + " | " + str(record["price"]))

    elif choice == "3":
        key = input("Enter Item to Search: ")
        found = False
        for record in records:
            if record["item"] == key:
                print("Found: " + str(record["item"]) + " | " + str(record["qty"]) + " | " + str(record["price"]))
                found = True
        if not found:
            print("No matching record was found.")

    elif choice == "4":
        key = input("Enter Item to Update: ")
        found = False
        for i in range(len(records)):
            if records[i]["item"] == key:
                records[i]["item"] = input("Enter New Item: ")
                records[i]["qty"] = int(input("Enter New Quantity: "))
                records[i]["price"] = float(input("Enter New Unit Price: "))
                print("Updated successfully!")
                found = True
                break
        if not found:
            print("No matching record was found.")

    elif choice == "5":
        key = input("Enter Item to Delete: ")
        found = False
        for i in range(len(records)):
            if records[i]["item"] == 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 Invoice Generator.")
        break

    else:
        print("Invalid Choice.")