public static void main(String[] args) {
		Random gen = new Random();
		for (int times = 0; times < 1000; ++times) {
			int n;
			if (args.length == 1) {
				n = Integer.valueOf(args[0]);
			} else {
				n = gen.nextInt(300) + 1;
			}
			int[][] professor_preference = new int[n][n], student_preference = new int[n][n];
			for (int i = 0; i < n; ++i) {
				for (int j = 0; j < n; ++j) {
					professor_preference[i][j] = j;
					student_preference[i][j] = j;
				}
				shuffle(professor_preference[i]);
				shuffle(student_preference[i]);
			}

		    /*
			for (int i = 0; i < n; ++i) {
				System.out.println("professor " + i);
				for (int j = 0; j < n; ++j) {
					System.out.println(professor_preference[i][j] + " ");
				}
				System.out.println();
			}
			for (int i = 0; i < n; ++i) {
				System.out.println("student " + i);
				for (int j = 0; j < n; ++j) {
					System.out.println(student_preference[i][j] + " ");
				}
				System.out.println();
			}
		    */
		    Pair<Integer,Integer>[] res =
		        find_stable_assignment(professor_preference, student_preference);
		    
		    /*
		    for (int i = 0; i < res.size(); ++i) {
		    	System.out.println(res.get(i).getFirst() + ", " + res.get(i).getSecond());
		    }
		    */
		    check_ans(professor_preference, student_preference, res);
		  }
	}