We won't do your homework for you, but if you'll post what you have, someone might be able to help. Specific questions are also more likely to get a reasonable response, too.
You need to use a technique that is referred to in posts on this site as a "flip-flop", or "alternator". Do a search. Then make an effort and post your logic and then describe what is not working.