How to get the top two in the group stage with the same score among the three parties?

Generally speaking, in the group match, the three teams have the same points, so you can compare the winning relationship and goal difference, but you mentioned that the record is the same, so you can't compare the winning relationship and goal difference.

This has never happened in reality, but the usual solution to this special case is to draw lots to decide which team is out. This is especially true for some large-scale activities. It is impossible to arrange play-offs, especially in today's highly commercialized world. Arranging play-offs can easily disrupt the schedule. So drawing lots is a way to solve this kind of problem.