class OddEArray {
    private long[] a;
    private int Element;
    
    public OddEArray(int maxsize) {
        a = new long[maxsize];
        Element = 0;
    }
    
    public void Insert(long value) {
        a[Element] =value;
        Element++;
    }
    
    public void display() {
        for(int i=0;i<Element;i++) {
            System.out.print(a[i]+" ");
        }
        System.out.println("");
    }
    
    public void OddEvenSort() {
        int exchange = 1;
        int i = 0;
        int j = 1;
        long temp = 0;
        while(exchange != 0) {
            exchange = 0;
            i = 0;
            j = 1;
            while(i<Element&&j<Element) {
                if(a[i]>a[j]) {
                    temp = a[i];
                    a[i] = a[j];
                    a[j] = temp;
                    exchange++;                
                }
                i+=2;
                if(i>=Element) continue;
                if(a[i]<a[j]) {
                    temp = a[j];
                    a[j] = a[i];
                    a[i] = temp;
                    exchange++;
                }
                j+=2;
            }
            
        }        
    }
}public class OddEvenSort {    public static void main (String[] arg) {
        
        OddEArray arr = new OddEArray(200);
        arr.Insert(34);
        arr.Insert(45);
        arr.Insert(75);
        arr.Insert(57);
        arr.Insert(56);
        arr.Insert(24);
        arr.Insert(65);
        arr.Insert(32);
        arr.Insert(78);
        arr.Insert(19);
        arr.display();
        arr.OddEvenSort();
        arr.display();
    }
}