var m,j:comp;b:string;procedure f(n,i:word);label 1;begin repeat for j:=0to n-1do if i-ord(b[2*j+1])+48in[0,n-j,j-n]then goto 1;str(b:-2*n,i,b);if n<m-1then f(n+1,0)else writeln(b);1:inc(i)until i=m end;begin read(m);f(0,0)end.
Note that non-ascii characters in the above source code will be escaped (such as \x9f).