2 layers of nested loop