optimize getLinesByTwoStations, realize with query