Write a function to implement a basic recommendation system for flight options based on user preferences for Breeze Airways.
Implement recommend_flights(options, preferences, top_k). Each option contains id, price, duration, stops, and departure_period. Filter out options exceeding optional max_price or max_duration. Add 3 points when stops matches preferred_stops, and 2 points when departure_period matches preferred_departure_period. Return up to top_k option IDs ordered by score descending, price ascending, duration ascending, then ID ascending. Return an empty list when no options qualify.
def recommend_flights(options, preferences, top_k):