records = []

while True:
    print("\n===== Inventory Management 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["id"] = int(input("Enter Item ID: "))
        record["name"] = input("Enter Item Name: ")
        record["qty"] = int(input("Enter Quantity: "))
        record["price"] = float(input("Enter Price: "))
        records.append(record)
        print("Added successfully!")

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

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

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

    elif choice == "5":
        key = int(input("Enter Item ID to Delete: "))
        found = False
        for i in range(len(records)):
            if records[i]["id"] == 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 Inventory Management System.")
        break

    else:
        print("Invalid Choice.")