using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;



namespace Test1 {

    class ClassMain {


        static int[,] disps = new int[,] { {0,1,1,1,1,1,1},//0
        {0,0,0,0,1,1,0},//1
        {1,0,1,1,0,1,1},//2
        {1,0,0,1,1,1,1},//3
        {1,1,0,0,1,1,0},//4
        {1,1,0,1,1,0,1},//5
        {1,1,1,1,1,0,1},//6
        {0,1,0,0,1,1,1},//7
        {1,1,1,1,1,1,1},//8
        {1,1,0,1,1,1,1}//9
        };

        public static void Main(String[] args) {
            string line;

            while ((line = Console.ReadLine()) != null) {
                int n = int.Parse(line);
                if (n == -1) { break; }
                int[] disp = new int[7];
                for(int i = 0; i<n; i++){
                    int k = int.Parse(Console.ReadLine());
                    int[] change = new int[7];
                    for (int j = 0; j < 7; j++) {
                        if (disp[j] != disps[k,j]) { change[j] = 1; }
                        disp[j] = disps[k, j];
                    }
                    Console.WriteLine(string.Join("",change));

                }

            }
        }


    }

}