I live in Va and just accepted a position in MD, do I pay taxes in MD or VA?

I live in VA and accepted a position in MD, which state to I pay taxes to?
Do I fill out a W4 for VA or MD