In a country, there are $28$ cities, and between some cities, there are two-way flights. Each city has exactly one airport, which can be either small, medium, or big. For every route that:
1. Contains more than two cities,
2. Does not repeat any city,
3. Ends where it begins,

It must include all types of airports. What is the maximum number of flights in this country?

Let's think step by step and output the final answer within \boxed{}.
user