finished: note that before reassign 'fisrst and second',reassign A[num]
frist