# Optimize for the time cost of m calls on your queue.
class Queue:

    def __init__(self):
        self.stack1 = []
        self.stack2 = []

    def enqueue(self, item):
        self.stack1.append(item)

    def dequeue(self):
        if len(self.stack2) == 0:
            while self.stack1:
                self.stack2.append(self.stack1.pop())

        if len(self.stack2) == 0:
            raise IndexError('Empty queue. Insert something first.')

        return self.stack2.pop()

c2a638cbe8ab89ba246554ed353dbb02ebe09c19
class Queue:
    <mask token>
    <mask token>
    <mask token>

class Queue:
    <mask token>

    def enqueue(self, item):
        self.stack1.append(item)
    <mask token>

class Queue:
    <mask token>

    def enqueue(self, item):
        self.stack1.append(item)

    def dequeue(self):
        if len(self.stack2) == 0:
            while self.stack1:
                self.stack2.append(self.stack1.pop())
        if len(self.stack2) == 0:
            raise IndexError('Empty queue. Insert something first.')
        return self.stack2.pop()

class Queue:

    def __init__(self):
        self.stack1 = []
        self.stack2 = []

    def enqueue(self, item):
        self.stack1.append(item)

    def dequeue(self):
        if len(self.stack2) == 0:
            while self.stack1:
                self.stack2.append(self.stack1.pop())
        if len(self.stack2) == 0:
            raise IndexError('Empty queue. Insert something first.')
        return self.stack2.pop()

# Optimize for the time cost of m calls on your queue.
class Queue:

    def __init__(self):
        self.stack1 = []
        self.stack2 = []

    def enqueue(self, item):
        self.stack1.append(item)

    def dequeue(self):
        if len(self.stack2) == 0:
            while self.stack1:
                self.stack2.append(self.stack1.pop())

        if len(self.stack2) == 0:
            raise IndexError('Empty queue. Insert something first.')

        return self.stack2.pop()
