Magnetic quantum wire as a spin filter: An exact study