class Solution:

    def reconstructQueue(self, people: List[List[int]]) ->List[List[int]]:
        people.sort(reverse=True, key=lambda x: (x[0], -x[1]))
        result = []
        for person in people:
            result.insert(person[1], person)
        return result

743037cf6964f8292ed241c24885785ebab3ad3a
<mask token>

class Solution:
    <mask token>

class Solution:

    def reconstructQueue(self, people: List[List[int]]) ->List[List[int]]:
        people.sort(reverse=True, key=lambda x: (x[0], -x[1]))
        result = []
        for person in people:
            result.insert(person[1], person)
        return result
