A switch will select the root port based on attributes that it receives in BPDUs.
Drag & drop in the correct order in which they are considered by the STP root port selection process.
The root port on a switch is the port that receives the best Spanning Tree Protocol (STP) bridge protocol data unit (BPDU), which indicates the best path to the root bridge based on the best root port cost. A root port is always in the forwarding state. Because there is only one best path to the root bridge, a switch cannot have more than one root port.
The root bridge sends BPDUs every two seconds by default. When a switch receives a BPDU, the receiving switch modifies the forwarding switch's bridge ID, port priority, port number, and cost to reach the root bridge before forwarding the BPDU to neighboring switches. The interface that receives the hello packet with the lowest path cost will become the root port. When a switch receives multiple BPDUs with the same path cost, it will choose the interface connected to the forwarding switch with the lowest bridge ID. When multiple equal-cost paths to a forwarding switch exist, the receiving switch will choose the lowest port priority of the forwarding switch. If all port priorities are equal, the receiving switch will choose the lowest port number of the forwarding switch.