public static void main(String args[])
	{
		sc = new Scanner(System.in);
		System.out.println("Enter the Total number of channels in main set!!");
		int m = sc.nextInt();
		arr = new int[m];
		for (int i = 0; i < m; i++)
		{
			arr[i] = i + 1;
		}
		System.out.println("Channels from 1 to " + m + " are available");
		
		// ===========================================

		System.out.println("Enter the number of channels in Sub_set1!!");
		int m1 = sc.nextInt();
		while (m1 > m)
		{
			System.out.println("Renter the channels <= " + m);
			m1=sc.nextInt();
		}
		arr1 = new int[m1];
		System.out.println("Enter the id of each channel");

		for (int i = 0; i < m1; i++)
		{
			arr1[i] = i+1;
		}
		disp(arr1);
		
		// ===========================================

		System.out.println("Enter the number of channels in Sub_set2!!");
		int m2 = sc.nextInt();
		while (m2 > m)
		{
			System.out.println("Renter the channels <= " + m);
		}
		arr2 = new int[m2];
		
		System.out.println("Also enter the common channels");
		int g=sc.nextInt();
		while (m2 +m1-g > m)
		{
			System.out.println("Renter the common channels cant choose the tuple m1,m2 and g such that m2 +m1-g > m");
			g=sc.nextInt();
		}

		for (int i = 0; i < m2; i++)
		{
			arr2[i] = arr[i+arr1.length-g];
		}
		disp(arr2);
		
		boolean b = find();
		if (b == false)
		{
			System.out.println("No channels were in common\n EXITED");
			System.exit(0);
		}
				

		Random r = new Random();
		boolean ren = false;

		// start choosing randomly
		int time = 0;
		do
		{
			time++;
			int index1 = r.nextInt(m1) ;
			int index2 = r.nextInt(m2);
			System.out.println("Ch1 is " + arr1[index1] + " Ch2 is  " +arr2[ index2]);
			if (arr1[index1] ==arr2[ index2])
			{
				System.out.println("Got Rendezvous at time= " + time);
				ren = true;
				System.exit(0);
			}
		} while (!ren);

	}