The brightest blue and red stars in M31