Implemented the 3 agents of task2.