finished hw2 for 3-match