static void Main(string[] args)
        {
            List <string> personsInfo = Console.ReadLine().Split(";", StringSplitOptions.RemoveEmptyEntries)
                                        .ToList();
            List <string> productsInfo = Console.ReadLine().Split(";", StringSplitOptions.RemoveEmptyEntries)
                                         .ToList();
            List <Person>  persons  = new List <Person>();
            List <Product> products = new List <Product>();


            for (int i = 0; i < personsInfo.Count; i++)
            {
                Person newPerson = Person.ReadNewPerson(personsInfo, i);
                persons.Add(newPerson);
            }

            for (int i = 0; i < productsInfo.Count; i++)
            {
                Product newProduct = Product.ReadNewProduct(productsInfo, i);
                products.Add(newProduct);
            }

            while (true)
            {
                string[] purchaseInfo = Console.ReadLine().Split().ToArray();

                if (purchaseInfo[0] == "END")
                {
                    break;
                }

                string  buyerName      = purchaseInfo[0];
                string  productName    = purchaseInfo[1];
                var     productList    = products.Where(x => x.Name == productName).ToArray();
                decimal price          = productList[0].Price;
                var     buyerInfo      = persons.Where(x => x.Name == buyerName).ToArray();
                decimal availableMoney = buyerInfo[0].Money;

                if (price <= availableMoney)
                {
                    int index = persons.FindIndex(x => x.Name == buyerName);
                    persons[index].UpdatePerson(productName, price);

                    Console.WriteLine($"{buyerName} bought {productName}");
                }
                else
                {
                    Console.WriteLine($"{buyerName} can't afford {productName}");
                }
            }

            persons.ForEach(x => Console.WriteLine(x));
        }