class MyList {
    int [] arr;
    public MyList () {
	arr = new int [10000];
        for (int i = 0; i < arr.length; i++) {
	    arr[i] = (int) (20000 * Math.random());

	}
    }

    public boolean contains(int x) {
        int r = arr.length/2;
        BoolHolder b = new BoolHolder(false);
        MyThread thread1 = new MyThread(x,arr, 0, r, b);
        MyThread thread2 = new MyThread(x,arr, r+1, arr.length - 1, b);
	thread1.start();
        thread2.start();
        try{thread1.join(0);}
        catch(InterruptedException e) {}

        try{thread2.join(0);}
        catch(InterruptedException e) {}

        return b.found;


    }
}
 
class BoolHolder {
    boolean found;
    public BoolHolder(boolean f) {
	found = f;
    }
}

public class Search {
    public static void main (String argv []) {

        MyList lst = new MyList();
        System.out.println(lst.contains(1000));

    }
} 

class MyThread extends Thread {
    int [] a;
    int left, right;
    BoolHolder c;
    int item;
    public MyThread (int x, int [] arr, int l, int r, BoolHolder b) {
	a = arr;
        left = l;
        right = r;
        c = b;
        item = x;
    }

    public void run () {
          
        int i = left;
	while (!c.found && (i < right + 1)) {
	    if (a[i] == item) c.found = true;
            i++;
	}

    }
}
