first solution of the assignment