The answer comes from two rules for a green light: the tram has priority over vehicles other than trams, and a driver turning left gives way to oncoming traffic going straight and turning right. The traffic light lets everyone go, so the tram goes first whatever its direction. The red car is turning left, so it gives way to the tram, to the oncoming yellow car going straight, and to the oncoming green car turning right. The blue car is going straight in the same direction as the red car and does not cross anyone's path, so it also goes before the red car. No one gives way to the red car, and it gives way to the tram and both oncoming cars, so it goes last