var i,n:comp;begin repeat read(n);for i:=1to 9do write($7807502ashr(abs(i-5)*6+n)and 1,(" ")[i]);writeln until 0>0end.