class C{
	private int numDifferentThanZero;
	private int[] a;

	C(){
		numDifferentThanZero = 0;
		a                    = new int[10];
	}

	public synchronized void print(){
		for(int i = 0; i < 10; i++)
			System.out.print(a[i] + " ");
		System.out.println();
	}

	public synchronized void set(int value, int index){
		/* Write this method in such a way that it helps
		 * in achieving the required behavior
		 **/	
	}
 
	public synchronized void m(){
		/* Only this print can be used to print the values */
		print();
	}

}



class T1 extends Thread{
	private C c;

	public T1(C c){
		this.c = c;
	}

	public void run(){
		for(int i = 0; i < 1000000; i++){
			int k = (int)(Math.random() * 11 - 5);
			c.set(k,i%10);
		}
	}
}



class T2 extends Thread{
	private C c;

	public T2(C c){
		this.c = c;
	}

	public void run(){
		c.m();
	}
}



public class D {
	public static void main(String[] argv){
		C  c = new C();
		T1 t = new T1(c);
		T2 r = new T2(c);
		T2 s = new T2(c);

		r.start();
		t.start();
		s.start();
	}
}
