/kloc-Class 0/8 participates in the basketball match. What competition system should be used?

If there is enough time, it will be divided into four groups. There are two groups and five teams. Each group will have a match between each team. The two teams with the best results in the group are promoted, and each group is equally distributed with the recognized strong teams of the year. In the second round, the second group draws lots for the first team, and then draws lots at random in the semi-finals. How was the final?