merge the two for-loops