L=[
"0111111",
"0000110",
"1011011",
"1001111",
"1100110",
"1101101",
"1111101",
"0100111",
"1111111",
"1111110"]
while True:
    n=input()
    if n==-1:break
    t="0000000"
    for i in range(n):
        a=input()
        print "".join("1" if i<>j else "0" for i,j in zip(L[a],t))
        t=L[a]