nb = vector(34)

is(d) = {
	my (f=vector(#d));
	for (k=1, #d,
		f[d[k]]++;
		if (d[k]!=1 && f[d[k]]>f[d[k]-1],
			return (0);
		);
	);
	return (1);
}

visit(s, f) = {
	my (r=Vecrev(s));
	if (is(concat(s,r)),
		nb[2*#s]++;
	);
	if (is(concat(s,r[2..#r])),
		nb[2*#s-1]++;
	);
	if (#s < #f,
		s = concat(s, 0);
		for (v=1, #f,
			if (v==1 || f[v-1]>f[v],
				f[v]++;
				s[#s] = v;
				visit(s, f);
				f[v]--;
			);
		);
	);
}

visit([1], vector(#nb/2, v, v==1))

print ("0 1");
apply (v -> print (n++ " " v), nb)

quit