R=range(10) s=[list(raw_input().replace("x","0").replace("o","-"))for x in R] for a in R:exec's=map(list,zip(*s))[::-1]\nfor z in s:\n for x in R[:9]:\n if z[x]==`a`and"."==z[x+1]:z[x+1]=`a+1`\n'*4 for x in s:print"".join(x)

Note that non-ascii characters in the above source code will be escaped (such as \x9f).