public static void main(String[] args){
		StringBuilder sb = new StringBuilder();
		int n = (int) 1e6 - 1;
		int digits = 9;
		List<Integer> avai = new ArrayList<Integer>();
		for(int i=0;i<10;i++) avai.add(i);
		while(digits>=0){
			int numPer = fac(digits);
			sb.append(""+findNthAndRemove(avai, n/numPer));
			digits--;
			n = n%numPer;
		}
		System.out.println(sb.toString());
	}