Implemented foreach loop to build lots a, b and c