Java unpredicted solution)
\nclass ZeroEvenOdd {\n    private int n;\n    \n    private ArrayDeque<Integer> schedule = new ArrayDeque();\n    \n    public ZeroEvenOdd(int n) {\n        th
```\nclass ZeroEvenOdd {\n    private int n;\n    \n    private ArrayDeque<Integer> schedule = new ArrayDeque();\n    \n    public ZeroEvenOdd(int n) {\n        this.n = n;\n        for(int i = 1; i <= n; i++) {\n            schedule.add(0);\n            schedule.add(i);\n        }\n    }\n\n    // printNumber.accept(x) outputs "x", where x is an integer.\n    public void zero(IntConsumer printNumber) throws InterruptedException {\n        synchronized(schedule) {\n            while(!schedule.isEmpty()) {\n                if(schedule.getFirst() != 0) {\n                    schedule.wait();\n                    continue;\n                }\n\n                printNumber.accept(schedule.removeFirst());\n\n                schedule.notifyAll();\n            }\n        }\n    }\n\n    public void even(IntConsumer printNumber) throws InterruptedException {\n        synchronized(schedule) {\n            while(!schedule.isEmpty()) {\n                if(schedule.getFirst() % 2 != 0 || schedule.getFirst() == 0) {\n                    schedule.wait();\n                    continue;\n                }\n\n                printNumber.accept(schedule.removeFirst());\n\n                schedule.notifyAll();\n            }\n        }\n    }\n\n    public void odd(IntConsumer printNumber) throws InterruptedException {\n        synchronized(schedule) {\n            while(!schedule.isEmpty()) {\n                if(schedule.getFirst() % 2 != 1 || schedule.getFirst() == 0) {\n                    schedule.wait();\n                    continue;\n                }\n\n                printNumber.accept(schedule.removeFirst());\n\n                schedule.notifyAll();\n            }\n        }\n    }\n}\n```
[]