program elektroninis_indikatorius;
  { 150 u‘davinys }
  const BR = 7; { br–kžneli— skai‡ius vieno skaitmens indikatoriuje }
        MAX_N = 100; { maksimalus sve‡i— skai‡ius }
  type skaitmuo = array [1..BR] of boolean;
       indikatorius = array [1..2] of skaitmuo;
       skaitmenys = array [0..9] of skaitmuo;
       sveciai = array [1..MAX_N] of 1..99;

 procedure ini_skaitmenys (var sk: skaitmenys);
 { inicializuoja masyv… skaitmenys }
   var aibe: array [0..9] of set of 1..BR;
       s, b: integer;
 begin
   aibe[1] := [3, 4];             aibe[2] := [2, 3, 5, 6, 7];
   aibe[3] := [2, 3, 4, 5, 7];    aibe[4] := [1, 3, 4, 7];
   aibe[5] := [1, 2, 4, 5, 7];    aibe[6] := [1, 2, 4, 5, 6, 7];
   aibe[7] := [2, 3, 4];          aibe[8] := [1, 2, 3, 4, 5, 6, 7];
   aibe[9] := [1, 2, 3, 4, 5, 7]; aibe[0] := [1, 2, 3, 4, 5, 6];
   for s := 0 to 9 do
     for b := 1 to BR do
       sk[s, b] := b in aibe[s]
 end; { ini_skaitmenys }

 procedure sugedo (n: integer; sv: sveciai; var ind: indikatorius);
 { randa indikatoriaus b–sen… po sve‡i— apsilankymo }
   var sk: skaitmenys;
       i, b, pirm, antr: integer;
 begin
   { inicializuojame masyv… skaitmenys }
   ini_skaitmenys (sk);
   { prad‘ioje indikatorius rod‚ 00 }
   ind[1] := sk[0]; ind[2] := sk[0];
   { eina sve‡iai }
   for i := 1 to n do
     begin
       pirm := sv[i] div 10;
       antr := sv[i] mod 10;
       for b := 1 to BR do
         begin
           ind[1, b] := ind[1, b] xor sk[pirm, b];
           ind[2, b] := ind[2, b] xor sk[antr, b];
         end;
     end;
 end; { sugedo }

 procedure spausdinti (ind: indikatorius);
 { ižveda  ekran… galutinŠ indikatoriaus b–sen… }
   const VER = 'I';
         HOR = '_';
         TUS = '.';
   var i, b, bruk: integer;
       eil: array [1..3, 1..BR] of char;
 begin
   { indikatori— spausdinsime trimis eilut‚mis }
   for i := 1 to 7 do
     if i = 4
        then eil[1, i] := ' '
        else eil[1, i] := TUS;
    eil[2] := eil[1]; eil[3] := eil[1];
   { suformuosime pirm… eilutŠ }
   if ind[1, 2] then eil[1, 2] := HOR;
   if ind[2, 2] then eil[1, 6] := HOR;
   { suformuosime antr…j… eilutŠ }
   for i := 1 to 2 do
     for b := 1 to 3 do
       begin
         if b = 2
            then bruk := 7
            else bruk := b;
         if ind [i, bruk]
            then if bruk <> 7 then eil[2, (i-1)*4 + b] := VER
                              else eil[2, (i-1)*4 + b] := HOR
       end;
   { suformuosime tre‡i…j… eilutŠ }
   for i := 1 to 2 do
    for b := 6 downto 4 do
     if ind[i, b]
        then if b <> 5  then eil[3, (i-1)*4 + 7-b] := VER
                        else eil[3, (i-1)*4 + 7-b] := HOR;
   { spausdiname }
   writeln ('Indikatoriaus b–sena');
   for i := 1 to 3 do
     writeln (eil[i]);
 end; { spausdinti }

  var n, i: integer;
      sv: sveciai;
      ind: indikatorius;
begin
  write ('­veskite sve‡i— skai‡i—: ');
  readln (n);
  if n > 0
     then write ('­veskite but— numerius: ');
  for i := 1 to n do
    read (sv[i]);
  sugedo (n, sv, ind);
  spausdinti (ind);
end.