Validating radio buttons

hi all

i have so many group of radio buttons
for eg :
g1 value =1
g1 value =2
g1 value =3


g2 value =1
g2 value =2
g2 value =3


g3 value =1
g3 value =2
g3 value =3




… etc

      where g1,g2 and g3 are the (group)radio butons ( so same name) and the values 1,2,3.

if somebody choosed the same value (for eg: I choosed the first radio button from all radio groups) i have to display a error message as don’t choose same radio buttons ( I mean he should choose different radio button)
any idea how to validate

please help me