Implemented Lab3.