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