public static void main(String[] args) {
		
		int n = 0, p = 0;//Triangle
		while((p = n*(n+1)/2) < 10000){
			grid[p][0] = true;
			n++;
		}
		n = 0; p = 0;//Square
		while((p = n*n) < 10000){
			grid[p][1] = true;
			n++;
		}
		n = 0; p = 0;//Pentagonal
		while((p = n*(3*n-1)/2) < 10000){
			grid[p][2] = true;
			n++;
		}
		n = 0; p = 0;//Hexagonal
		while((p = n*(2*n-1)) < 10000){
			grid[p][3] = true;
			n++;
		}
		n = 0; p = 0;//Heptagonal
		while((p = n*(5*n-3)/2) < 10000){
			grid[p][4] = true;
			n++;
		}
		n = 0; p = 0;//Octogonal
		while((p = n*(3*n-2)) < 10000){
			grid[p][5] = true;
			n++;
		}
		
		for(int i = 1000; i < 10000; i++){
			Go(i, i, 1, new boolean[]{false, false, false, false, false, false}, "", i);
		}
	}