use 2 for loops