Instead of looping over all the radio buttons in the page,
loop over rows,
and use a block scope variable to check whether no button is clicked in that row,
and use inner loop to loop over buttons in each row.
a demo based on edit of your code: