tuan6.py is the final version