use stack to keep tag