You could try the General Sibling Selector(~) if the input boxes are next to each other.
Something like:
.a:focus { background-color:Blue;}
.a:focus~.b { background-color:Blue;}
.b:focus { background-color:Yellow;}
.b:focus~.a { background-color:Yellow;}
Note: Completely untested and a stab in the dark at best!