solution to the first assignment