/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Counter {
    private int count = 0;

    public synchronized void printOdd() {
    	while(count%2==0){
    		try{
    		wait();
    		}catch(InterruptedException e){
    		Thread.currentThread().interrupt();
    		}
    	}
    	System.out.println("ODD "+count);
        count++;  // Thread-safe increment
        
        notify();
    }
	public synchronized void printEven() {
    	while(count%2==1){
    		try{
    		wait();
    		}catch(InterruptedException e){
    		Thread.currentThread().interrupt();
    		}
    	}
    	System.out.println("EVEN "+count);
        count++;  // Thread-safe increment
        
        notify();
    }
}
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Counter c= new Counter();
		Thread t1 = new Thread(new Runnable(){
			@Override
			public void run(){
				for(int i=0;i<6;i++){
					c.printEven();
				}
			}
		}
			);
		Thread t2 = new Thread(new Runnable(){
			@Override
			public void run(){
				for(int i=0;i<5;i++){
					c.printOdd();
				}
			}
		}
			);
		t1.start();
		t2.start();
		
		t1.join();
		t2.join();
	}
}