Python use 2 Queue to synchronize
\nfrom Queue import Queue\n\n\nclass Foo(object):\n    def __init__(self):\n        self.q1 = Queue()\n        self.q2 = Queue()\n\n    def first(self, printFir
```\nfrom Queue import Queue\n\n\nclass Foo(object):\n    def __init__(self):\n        self.q1 = Queue()\n        self.q2 = Queue()\n\n    def first(self, printFirst):\n        """\n        :type printFirst: method\n        :rtype: void\n        """\n        # printFirst() outputs "first". Do not change or remove this line.\n        printFirst()\n        self.q1.put(1)\n\n\n    def second(self, printSecond):\n        """\n        :type printSecond: method\n        :rtype: void\n        """\n        self.q1.get()\n        printSecond()\n        self.q2.put(1)\n            \n            \n    def third(self, printThird):\n        """\n        :type printThird: method\n        :rtype: void\n        """\n        self.q2.get()\n        printThird()\n```
[]