Don't declare new variables a,b - this is only confusing, use a[i] and b[i] directly.
Anyway I don't understand what you try to accomplish.
Let's try a new thing, leave writing code, describe your algorithm to find reflexive set in words (no code), I believe the algorithm you have in mind isn't good.
Then we will implement it.