For each q, where 1≤q≤n′, do Step 2 through Step 8: