using System;
using System.Collections.Generic;
namespace aizu
{
    class OnlineJudge
    {
        static readonly byte[] SevenStars = new byte[]{
            0x3F, 0x06, 0x5B, 0x4F, 0x66,
            0x6D, 0x7D, 0x27, 0x7F, 0x6F
        };
        static void Main()
        {
            int count;
            while(int.TryParse(Console.ReadLine(), out count) && count != -1) {
                byte output = 0x00;
                for(int i=0; i < count; ++i) {
                    int value = int.Parse(Console.ReadLine());
                    ByteView((byte)(output ^ SevenStars[value]));
                    output = SevenStars[value];
                }
            }
        }
        static void ByteView(byte value)
        {
            string output = string.Empty;
            for(int i=0; i < 7; ++i) {
                output += ((value << i) & 0x40) == 0x40 ? "1" : "0";
            }
            Console.WriteLine(output);
        }
    }
}