Semaphore
\nclass Foo {\n    Semaphore run2, run3;\n\n    public Foo() {\n        run2 = new Semaphore(0);\n        run3 = new Semaphore(0);\n    }\n\n    public void fir
```\nclass Foo {\n    Semaphore run2, run3;\n\n    public Foo() {\n        run2 = new Semaphore(0);\n        run3 = new Semaphore(0);\n    }\n\n    public void first(Runnable printFirst) throws InterruptedException {\n        \n        // printFirst.run() outputs "first". Do not change or remove this line.\n        printFirst.run();\n        run2.release();\n\n    }\n\n    public void second(Runnable printSecond) throws InterruptedException {\n        run2.acquire();\n        // printSecond.run() outputs "second". Do not change or remove this line.\n        printSecond.run();\n        run3.release();\n    }\n\n    public void third(Runnable printThird) throws InterruptedException {\n        run3.acquire();\n        // printThird.run() outputs "third". Do not change or remove this line.\n        printThird.run();\n    }\n}\n\n```
[]