[lab3] passes lab1, lab 2 test cases