public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line = "";
		out = new StringBuilder();
		int nCase = 1;
		while ((line = in.readLine()) != null && line.length() != 0) {
			if (line.equals("0"))
				break;
			v = readInts(line);
			Arrays.sort(v,1,v.length);
			if (nCase++ != 1)
				out.append("\n");
			for (int i = 1; i <= v.length-6; i++)
				solve(i + 1, 1, v[i]+"");

		}
		System.out.print(out);
	}