I am trying to write an algorithm and I encountered this problem. I wrote a simplified version to single the problem out. In this code, I create objects of the class A in a