public String simulate(int[] preference1, int[] preference2) {
		char[] result = new char[preference1.length];
		for (int i = 0; i < result.length; i++) {
			for (int j = i; j < result.length; j++) {
				if (result[preference1[j] - 1] == 0) {
					result[preference1[j] - 1] = '1';
					break;
				}
			}
			for (int j = i; j < result.length; j++) {
				if (result[preference2[j] - 1] == 0) {
					result[preference2[j] - 1] = '2';
					break;

				}
			}
		}
		return new String(result);
	}