class Solution:
    def deckRevealedIncreasing(self, deck):
        """
        :type deck: List[int]
        :rtype: List[int]
        """
        deck = sorted(deck)
        l = len(deck)

        d = collections.deque(list(range(l)))
        mapping = {}
        for i in range(l):
            j = d.popleft()
            mapping[j] = i
            if len(d) > 0:
                d.append(d.popleft())
        # print(mapping)
        out = [deck[mapping[i]] for i in range(l)]
        return out

48075bf2ad411a1b95975c2c48dad3f660a4f465
<mask token>

class Solution:
    <mask token>

class Solution:

    def deckRevealedIncreasing(self, deck):
        """
        :type deck: List[int]
        :rtype: List[int]
        """
        deck = sorted(deck)
        l = len(deck)
        d = collections.deque(list(range(l)))
        mapping = {}
        for i in range(l):
            j = d.popleft()
            mapping[j] = i
            if len(d) > 0:
                d.append(d.popleft())
        out = [deck[mapping[i]] for i in range(l)]
        return out

class Solution:
    def deckRevealedIncreasing(self, deck):
        """
        :type deck: List[int]
        :rtype: List[int]
        """
        deck = sorted(deck)
        l = len(deck)

        d = collections.deque(list(range(l)))
        mapping = {}
        for i in range(l):
            j = d.popleft()
            mapping[j] = i
            if len(d) > 0:
                d.append(d.popleft())
        # print(mapping)
        out = [deck[mapping[i]] for i in range(l)]
        return out
