Problem:
Problem B: High & Low Cube
僕は近所の小学生たちと一緒に夏祭りに来ていた。有り体に言えば保護者役だが、出店の焼きそばやたこ焼きなんかが焼ける匂い、時折聞こえる打ち上げ花火の音などは、この歳になっても心が踊るものがある。が、好奇心旺盛な子供たちがはぐれないように、今日はしっかり見守っていないと。
子供たちはとある出店に興味を持ったようだった。覗き込んでみると、そこでは出店のおじさんとサイコロを使ったゲームをして、勝てば景品が貰えることになっていた。そのゲームは、 High & Low と呼ばれる単純なものだ。参加者とおじさんは1個ずつサイコロを振るが、その前に参加者は、自分の出目がおじさんの出目より大きいか小さいかを予想する。予想が当たれば勝利であり、同じ目が出た場合はどちらもサイコロを振り直す。
このゲームの少し厄介なところは、参加者のサイコロとおじさんのサイコロが違うものであるかもしれない、という点だ。参加者はあらかじめ両者のサイコロの展開図を見ることができるので、それをヒントに予想することになる。
つまり、簡単な確率の計算だ。とはいえ確率は高校数学の範囲で、小学生にはちょっと荷が重いかもしれない。子供たちの中で一番利発そうな子でさえ、三つ編みにした髪を揺らしながら考え込んでいる。もうすぐ僕に助けを求めてくることだろう。さて、たまにはオトナらしいところを見せてあげようではないか。
Input
入力は複数のケースからなる。
各ケースでは、サイコロの展開図が21×57のグリッドで与えられる。
最初の21×28（(0,0)が左上,(20,27)が右下）のグリッドが参加者のサイコロを表す。
最後の21×28（(0,29)が左上,(20,56)が右下）がおじさんのサイコロを表す。
参加者のサイコロの各面は(0,7)、(7,0)、(7,7)、(7,14)、(7,21)、(14,7)を左上とする7×7のサブグリッドで与えられている。
展開図に書かれている数字は、それぞれ元の数字を
左右反転
左右反転、そのあとで反時計回りに90度回転
左右反転
左右反転、そのあとで反時計回りに270度回転
左右反転
上下反転、そのあとで左右反転
させたものである。
おじさんのサイコロの各面は(0,36)、(7,29)、(7,36)、(7,43)、(7,50)、(14,36)を左上とする７×７のサブグリッドで与えられている。
おじさんのサイコロの展開図に書かれている数字は参加者のサイコロと同じ規則で描かれている。
サイコロの各面には1から9までの中のどれかが書かれている。
数字は以下のような7x7のグリッドで与えられる。
#######
#.....#
#...|.#
#.....#
#...|.#
#..-..#
#######

#######
#..-..#
#...|.#
#..-..#
#.|...#
#..-..#
#######

#######
#..-..#
#...|.#
#..-..#
#...|.#
#..-..#
#######

#######
#.....#
#.|.|.#
#..-..#
#...|.#
#.....#
#######

#######
#..-..#
#.|...#
#..-..#
#...|.#
#..-..#
#######

#######
#..-..#
#.|...#
#..-..#
#.|.|.#
#..-..#
#######

#######
#..-..#
#...|.#
#.....#
#...|.#
#.....#
#######

#######
#..-..#
#.|.|.#
#..-..#
#.|.|.#
#..-..#
#######

#######
#..-..#
#.|.|.#
#..-..#
#...|.#
#..-..#
#######
ただし上記の数字を90度、または270度回転させた時、"|"と"-"は入れ替わっている。
入力の終わりは1つの0からなる行によって与えられる
入力として与えられるサイコロは必ず正しい物である。
また決着がつかないようなサイコロは与えられない。
Output
"HIGH"になる場合と"LOW"になる場合で確率が高いほうを1行に出力せよ。
両者の確率が同じ場合は"HIGH"を出力せよ。
Sample input
.......#######......................#######..............
.......#.....#......................#..-..#..............
.......#.|...#......................#.|.|.#..............
.......#.....#......................#..-..#..............
.......#.|...#......................#.|...#..............
.......#..-..#......................#..-..#..............
.......#######......................#######..............
############################.############################
#.....##..-..##.....##..-..#.#.....##..-..##.....##..-..#
#.-.-.##...|.##.-.-.##.|.|.#.#.....##.|.|.##.-.-.##.|.|.#
#|.|.|##..-..##|.|.|##..-..#.#....|##..-..##|.|.|##..-..#
#...-.##.|...##...-.##.|.|.#.#.-.-.##.|...##...-.##.|...#
#.....##..-..##.....##..-..#.#.....##..-..##.....##..-..#
############################.############################
.......#######......................#######..............
.......#..-..#......................#..-..#..............
.......#.|...#......................#.|...#..............
.......#..-..#......................#..-..#..............
.......#.|.|.#......................#...|.#..............
.......#..-..#......................#..-..#.........
...(truncated)

Submitted solutions:

code_snippet: #include <algorithm>
#include <iostream>
#include <string>
#define N 21
#define T 7
using namespace std;
void Change(int);
void Rot_Left();
int stoi();
string s[N],t[T];

int main(){
  int a[2][6],coma,comb,d[2][6][2]={
    {{0,7},{7,0},{7,7},{7,14},{7,21},{14,7}},
    {{0,36},{7,29},{7,36},{7,43},{7,50},{14,36}}
  };
  while(1){
    cin>>s[0];
    if(s[0]=="0") break;
    for(int i=1;i<N;i++) cin>>s[i];
    for(int i=0;i<2;i++){
      for(int j=0;j<6;j++){
	for(int k=0;k<T;k++) t[k]=s[k+d[i][j][0]].substr(d[i][j][1],7);
	Change(j);
	a[i][j]=stoi();
      }
    }
    coma=comb=0;
    for(int i=0;i<6;i++){
      for(int j=0;j<6;j++){
	if(a[0][i]>a[1][j]) coma++;
	else if(a[0][i]<a[1][j]) comb++;
      }
    }
    if(coma>=comb) cout<<"HIGH"<<endl;
    else cout<<"LOW"<<endl;
  }
  return 0;
}

void Change(int x){
  for(int i=0;i<T;i++) reverse(t[i].begin(),t[i].end());
  if(x==1) Rot_Left();
  if(x==3)
    for(int i=0;i<3;i++) Rot_Left();
  if(x==5) swap(t[1],t[5]),swap(t[2],t[4]);
}

void Rot_Left(){
  string temp[T];
  for(int i=0;i<T;i++) temp[i]=t[i];
  for(int i=0;i<T;i++)
    for(int j=0;j<T;j++){
      temp[i][j]=t[j][T-i-1];
      if(temp[i][j]=='-') temp[i][j]='|';
      else if(temp[i][j]=='|') temp[i][j]='-';
    }
  for(int i=0;i<T;i++) t[i]=temp[i];
}

int stoi(){
  string data[9][T]={
    {"#######","#.....#","#...|.#","#.....#","#...|.#","#..-..#","#######"},
    {"#######","#..-..#","#...|.#","#..-..#","#.|...#","#..-..#","#######"},
    {"#######","#..-..#","#...|.#","#..-..#","#...|.#","#..-..#","#######"},
    {"#######","#.....#","#.|.|.#","#..-..#","#...|.#","#.....#","#######"},
    {"#######","#..-..#","#.|...#","#..-..#","#...|.#","#..-..#","#######"},
    {"#######","#..-..#","#.|...#","#..-..#","#.|.|.#","#..-..#","#######"},
    {"#######","#..-..#","#...|.#","#.....#","#...|.#","#.....#","#######"},
    {"#######","#..-..#","#.|.|.#","#..-..#","#.|.|.#","#..-..#","#######"},
    {"#######","#..-..#","#.|.|.#","#..-..#","#...|.#","#..-..#","#######"},
  };
  for(int i=0;i<9;i++){
    int flag=0;
    for(int j=0;j<T;j++)
      if(t[j]!=data[i][j]) flag=1;
    if(!flag) return i+1;
  }
}
accuracy: 1
time_ms: 10
memory_kb: 1200
final_rank: 9

code_snippet: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cassert>
#include <random>
using namespace std;
int dicea[6],diceb[6];
string str[21];
int mk_num(string *);

void lr_hanten(string a[]){
  for(int i=0;i<7;i++)
    for(int j=0;j<7/2;j++) swap(a[i][j],a[i][6-j]);
}

void ud_hanten(string a[]){
  for(int i=0;i<7;i++) 
    for(int j=0;j<7/2;j++) swap(a[j][i],a[6-j][i]);
}

void rol_90(string a[]){
  string b[7];
  for(int i=0;i<7;i++)
    for(int j=0;j<7;j++) {
      b[i] += a[j][6-i];
      if(b[i][j] == '-') b[i][j] = '|';
      else if(b[i][j] =='|') b[i][j] = '-';
    }
  for(int i=0;i<7;i++) a[i] = b[i];
}

void choice(string num[],int x,int y){
  for(int i=0;i<7;i++){
    num[i]="";
    for(int j=0;j<7;j++) num[i]+=str[y+i][x+j];
  }
}

void mk_dice(){
  string num[2][7];
  //ue
  choice(num[0],7,0),choice(num[1],36,0);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[0] = mk_num(num[0]),diceb[0]=mk_num(num[1]);
  
  //hidari
  choice(num[0],0,7),choice(num[1],29,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  rol_90(num[0]),rol_90(num[1]);
  dicea[1] = mk_num(num[0]),diceb[1] = mk_num(num[1]);

  //mid_hidari
  choice(num[0],7,7),choice(num[1],36,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[2] = mk_num(num[0]),diceb[2] = mk_num(num[1]);

  //mid_migi
  choice(num[0],14,7),choice(num[1],43,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  for(int i=0;i<3;i++)rol_90(num[0]),rol_90(num[1]);
  dicea[3] = mk_num(num[0]),diceb[3] = mk_num(num[1]);

  //migi
  choice(num[0],21,7),choice(num[1],50,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[4] = mk_num(num[0]),diceb[4] = mk_num(num[1]);


  //sita
  choice(num[0],7,14),choice(num[1],36,14);
  ud_hanten(num[0]),ud_hanten(num[1]);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[5] = mk_num(num[0]),diceb[5] = mk_num(num[1]);
}

int main(){
  srand((unsigned)time(NULL));
  while(1) {
    for(int i=0;i<21;i++){
      cin >> str[i];
      if(str[i]=="0")break;
    }
    if(str[0]=="0")break;
    mk_dice();
    int a=0,b=0;
    for(int i=0;i<6;i++) assert(dicea[i]!=-1 && diceb[i]!=-1);

    int arr[6]={};
    std::random_device rnd;    
    for(int i=0;i<10000;i++){
      arr[rnd()%6]++;
      if(dicea[rnd()%6] > diceb[rnd()%6]) a++;
      else if(dicea[rnd()%6]<diceb[rnd()%6])b++;
    }
    // for(int i=0;i<6;i++) cout <<arr[i]<<" ";cout<<endl;
    if(a>b-100) cout<<"HIGH"<<endl;
    else cout <<"LOW"<<endl;
  }

}

int mk_num(string a[]){
  if(a[1]=="#.....#" &&
     a[2]=="#...|.#") return 1;

  if(a[1]=="#..-..#" && 
     a[2]=="#...|.#" &&   
     a[3]=="#..-..#" &&
     a[4]=="#.|...#" &&
     a[5]=="#..-..#") return 2;

  if(a[1]=="#..-..#" && 
     a[2]=="#...|.#" &&   
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 3;

  if(a[1]=="#.....#" &&
     a[5]=="#.....#") return 4;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|...#" &&
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 5;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|...#" &&
     a[3]=="#..-..#" &&
     a[4]=="#.|.|.#" &&
     a[5]=="#..-..#") return 6;

  if(a[3]=="#.....#" &&
     a[5]=="#.....#") return 7;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|.|.#" &&
     a[3]=="#..-..#" &&
     a[4]=="#.|.|.#" &&
     a[5]=="#..-..#") return 8;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|.|.#" &&
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 9;
  return -1;
}
accuracy: 0.5
time_ms: 430
memory_kb: 3028
final_rank: 19

code_snippet: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cassert>
#include <random>
using namespace std;
int dicea[6],diceb[6];
string str[21];
int mk_num(string *);

void lr_hanten(string a[]){
  for(int i=0;i<7;i++)
    for(int j=0;j<7/2;j++) swap(a[i][j],a[i][6-j]);
}

void ud_hanten(string a[]){
  for(int i=0;i<7;i++) 
    for(int j=0;j<7/2;j++) swap(a[j][i],a[6-j][i]);
}

void rol_90(string a[]){
  string b[7];
  for(int i=0;i<7;i++)
    for(int j=0;j<7;j++) {
      b[i] += a[j][6-i];
      if(b[i][j] == '-') b[i][j] = '|';
      else if(b[i][j] =='|') b[i][j] = '-';
    }
  for(int i=0;i<7;i++) a[i] = b[i];
}

void choice(string num[],int x,int y){
  for(int i=0;i<7;i++){
    num[i]="";
    for(int j=0;j<7;j++) num[i]+=str[y+i][x+j];
  }
}

void mk_dice(){
  string num[2][7];
  //ue
  choice(num[0],7,0),choice(num[1],36,0);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[0] = mk_num(num[0]),diceb[0]=mk_num(num[1]);
  
  //hidari
  choice(num[0],0,7),choice(num[1],29,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  rol_90(num[0]),rol_90(num[1]);
  dicea[1] = mk_num(num[0]),diceb[1] = mk_num(num[1]);

  //mid_hidari
  choice(num[0],7,7),choice(num[1],36,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[2] = mk_num(num[0]),diceb[2] = mk_num(num[1]);

  //mid_migi
  choice(num[0],14,7),choice(num[1],43,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  for(int i=0;i<3;i++)rol_90(num[0]),rol_90(num[1]);
  dicea[3] = mk_num(num[0]),diceb[3] = mk_num(num[1]);

  //migi
  choice(num[0],21,7),choice(num[1],50,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[4] = mk_num(num[0]),diceb[4] = mk_num(num[1]);


  //sita
  choice(num[0],7,14),choice(num[1],36,14);
  ud_hanten(num[0]),ud_hanten(num[1]);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[5] = mk_num(num[0]),diceb[5] = mk_num(num[1]);
}

int main(){
  srand((unsigned)time(NULL));
  while(1) {
    for(int i=0;i<21;i++){
      cin >> str[i];
      if(str[i]=="0")break;
    }
    if(str[0]=="0")break;
    mk_dice();
    int a=0,b=0;
    for(int i=0;i<6;i++) assert(dicea[i]!=-1 && diceb[i]!=-1);

    int arr[6]={};
    std::random_device rnd;    
    for(int i=0;i<10000;i++){
      arr[rnd()%6]++;
      if(dicea[rnd()%6] > diceb[rnd()%6]) a++;
      else if(dicea[rnd()%6]<diceb[rnd()%6])b++;
    }
    // for(int i=0;i<6;i++) cout <<arr[i]<<" ";cout<<endl;
    if(a>b-500) cout<<"HIGH"<<endl;
    else cout <<"LOW"<<endl;
  }

}

int mk_num(string a[]){
  if(a[1]=="#.....#" &&
     a[2]=="#...|.#") return 1;

  if(a[1]=="#..-..#" && 
     a[2]=="#...|.#" &&   
     a[3]=="#..-..#" &&
     a[4]=="#.|...#" &&
     a[5]=="#..-..#") return 2;

  if(a[1]=="#..-..#" && 
     a[2]=="#...|.#" &&   
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 3;

  if(a[1]=="#.....#" &&
     a[5]=="#.....#") return 4;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|...#" &&
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 5;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|...#" &&
     a[3]=="#..-..#" &&
     a[4]=="#.|.|.#" &&
     a[5]=="#..-..#") return 6;

  if(a[3]=="#.....#" &&
     a[5]=="#.....#") return 7;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|.|.#" &&
     a[3]=="#..-..#" &&
     a[4]=="#.|.|.#" &&
     a[5]=="#..-..#") return 8;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|.|.#" &&
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 9;
  return -1;
}
accuracy: 0.5
time_ms: 440
memory_kb: 3152
final_rank: 20

code_snippet: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cassert>
using namespace std;
int dicea[6],diceb[6];
string str[21];
int mk_num(string *);

void lr_hanten(string a[]){
  for(int i=0;i<7;i++)
    for(int j=0;j<7/2;j++) swap(a[i][j],a[i][6-j]);
}

void ud_hanten(string a[]){
  for(int i=0;i<7;i++) 
    for(int j=0;j<7/2;j++) swap(a[j][i],a[6-j][i]);
}

void rol_90(string a[]){
  string b[7];
  for(int i=0;i<7;i++)
    for(int j=0;j<7;j++) {
      b[i] += a[j][6-i];
      if(b[i][j] == '-') b[i][j] = '|';
      else if(b[i][j] =='|') b[i][j] = '-';
    }
  for(int i=0;i<7;i++) a[i] = b[i];
}

void choice(string num[],int x,int y){
  for(int i=0;i<7;i++){
    num[i]="";
    for(int j=0;j<7;j++) num[i]+=str[y+i][x+j];
  }
}

void mk_dice(){
  string num[2][7];
  //ue
  choice(num[0],7,0),choice(num[1],36,0);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[0] = mk_num(num[0]),diceb[0]=mk_num(num[1]);
  
  //hidari
  choice(num[0],0,7),choice(num[1],29,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  rol_90(num[0]),rol_90(num[1]);
  dicea[1] = mk_num(num[0]),diceb[1] = mk_num(num[1]);

  //mid_hidari
  choice(num[0],7,7),choice(num[1],36,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[2] = mk_num(num[0]),diceb[2] = mk_num(num[1]);

  //mid_migi
  choice(num[0],14,7),choice(num[1],43,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  for(int i=0;i<3;i++)rol_90(num[0]),rol_90(num[1]);
  dicea[3] = mk_num(num[0]),diceb[3] = mk_num(num[1]);

  //migi
  choice(num[0],21,7),choice(num[1],50,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[4] = mk_num(num[0]),diceb[4] = mk_num(num[1]);


  //sita
  choice(num[0],7,14),choice(num[1],36,14);
  ud_hanten(num[0]),ud_hanten(num[1]);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[5] = mk_num(num[0]),diceb[5] = mk_num(num[1]);
}

int main(){
  srand((unsigned)time(NULL));
  while(1) {
    for(int i=0;i<21;i++){
      cin >> str[i];
      if(str[i]=="0")break;
    }
    if(str[0]=="0")break;
    mk_dice();
    int a=0,b=0;
    for(int i=0;i<6;i++) assert(dicea[i]!=-1 && diceb[i]!=-1);

    int arr[6]={};
    for(int i=0;i<100000;i++){
      arr[rand()%6]++;
      if(dicea[rand()%6] > diceb[rand()%6]) a++;
      else if(dicea[rand()%6]<diceb[rand()%6])b++;
    }
    // for(int i=0;i<6;i++) cout <<arr[i]<<" ";cout<<endl;
    if(a>b-5000) cout<<"HIGH"<<endl;
    else cout <<"LOW"<<endl;
  }

}

int mk_num(string a[]){
  if(a[1]=="#.....#" &&
     a[2]=="#...|.#") return 1;

  if(a[1]=="#..-..#" && 
     a[2]=="#...|.#" &&   
     a[3]=="#..-..#" &&
     a[4]=="#.|...#" &&
     a[5]=="#..-..#") return 2;

  if(a[1]=="#..-..#" && 
     a[2]=="#...|.#" &&   
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 3;

  if(a[1]=="#.....#" &&
     a[5]=="#.....#") return 4;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|...#" &&
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 5;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|...#" &&
     a[3]=="#..-..#" &&
     a[4]=="#.|.|.#" &&
     a[5]=="#..-..#") return 6;

  if(a[3]=="#.....#" &&
     a[5]=="#.....#") return 7;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|.|.#" &&
     a[3]=="#..-..#" &&
     a[4]=="#.|.|.#" &&
     a[5]=="#..-..#") return 8;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|.|.#" &&
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 9;
  return -1;
}
accuracy: 0.5
time_ms: 430
memory_kb: 1196
final_rank: 16

code_snippet: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cassert>
using namespace std;
int dicea[6],diceb[6];
string str[21];
int mk_num(string *);

void lr_hanten(string a[]){
  for(int i=0;i<7;i++)
    for(int j=0;j<7/2;j++) swap(a[i][j],a[i][6-j]);
}

void ud_hanten(string a[]){
  for(int i=0;i<7;i++) 
    for(int j=0;j<7/2;j++) swap(a[j][i],a[6-j][i]);
}

void rol_90(string a[]){
  string b[7];
  for(int i=0;i<7;i++)
    for(int j=0;j<7;j++) {
      b[i] += a[j][6-i];
      if(b[i][j] == '-') b[i][j] = '|';
      else if(b[i][j] =='|') b[i][j] = '-';
    }
  for(int i=0;i<7;i++) a[i] = b[i];
}

void choice(string num[],int x,int y){
  for(int i=0;i<7;i++){
    num[i]="";
    for(int j=0;j<7;j++) num[i]+=str[y+i][x+j];
  }
}

void mk_dice(){
  string num[2][7];
  //ue
  choice(num[0],7,0),choice(num[1],36,0);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[0] = mk_num(num[0]),diceb[0]=mk_num(num[1]);
  
  //hidari
  choice(num[0],0,7),choice(num[1],29,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  rol_90(num[0]),rol_90(num[1]);
  dicea[1] = mk_num(num[0]),diceb[1] = mk_num(num[1]);

  //mid_hidari
  choice(num[0],7,7),choice(num[1],36,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[2] = mk_num(num[0]),diceb[2] = mk_num(num[1]);

  //mid_migi
  choice(num[0],14,7),choice(num[1],43,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  for(int i=0;i<3;i++)rol_90(num[0]),rol_90(num[1]);
  dicea[3] = mk_num(num[0]),diceb[3] = mk_num(num[1]);

  //migi
  choice(num[0],21,7),choice(num[1],50,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[4] = mk_num(num[0]),diceb[4] = mk_num(num[1]);


  //sita
  choice(num[0],7,14),choice(num[1],36,14);
  ud_hanten(num[0]),ud_hanten(num[1]);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[5] = mk_num(num[0]),diceb[5] = mk_num(num[1]);
}

int main(){
  srand((unsigned)time(NULL));
  while(1) {
    for(int i=0;i<21;i++){
      cin >> str[i];
      if(str[i]=="0")break;
    }
    if(str[0]=="0")break;
    mk_dice();
    int a=0,b=0;
    for(int i=0;i<6;i++) assert(dicea[i]!=-1 && diceb[i]!=-1);

    int arr[6]={};
    for(int i=0;i<100000;i++){
      arr[rand()%6]++;
      if(dicea[rand()%6] > diceb[rand()%6]) a++;
      else if(dicea[rand()%6]<diceb[rand()%6])b++;
    }
    // for(int i=0;i<6;i++) cout <<arr[i]<<" ";cout<<endl;
    if(a>b-500) cout<<"HIGH"<<endl;
    else cout <<"LOW"<<endl;
  }

}

int mk_num(string a[]){
  if(a[1]=="#.....#" &&
     a[2]=="#...|.#") return 1;

  if(a[1]=="#..-..#" && 
     a[2]=="#...|.#" &&   
     a[3]=="#..-..#" &&
     a[4]=="#.|...#" &&
     a[5]=="#..-..#") return 2;

  if(a[1]=="#..-..#" && 
     a[2]=="#...|.#" &&   
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 3;

  if(a[1]=="#.....#" &&
     a[5]=="#.....#") return 4;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|...#" &&
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 5;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|...#" &&
     a[3]=="#..-..#" &&
     a[4]=="#.|.|.#" &&
     a[5]=="#..-..#") return 6;

  if(a[3]=="#.....#" &&
     a[5]=="#.....#") return 7;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|.|.#" &&
     a[3]=="#..-..#" &&
     a[4]=="#.|.|.#" &&
     a[5]=="#..-..#") return 8;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|.|.#" &&
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 9;
  return -1;
}
accuracy: 0.5
time_ms: 430
memory_kb: 1196
final_rank: 16

code_snippet: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cassert>
using namespace std;
int dicea[6],diceb[6];
string str[21];
int mk_num(string *);

void lr_hanten(string a[]){
  for(int i=0;i<7;i++)
    for(int j=0;j<7/2;j++) swap(a[i][j],a[i][6-j]);
}

void ud_hanten(string a[]){
  for(int i=0;i<7;i++) 
    for(int j=0;j<7/2;j++) swap(a[j][i],a[6-j][i]);
}

void rol_90(string a[]){
  string b[7];
  for(int i=0;i<7;i++)
    for(int j=0;j<7;j++) {
      b[i] += a[j][6-i];
      if(b[i][j] == '-') b[i][j] = '|';
      else if(b[i][j] =='|') b[i][j] = '-';
    }
  for(int i=0;i<7;i++) a[i] = b[i];
}

void choice(string num[],int x,int y){
  for(int i=0;i<7;i++){
    num[i]="";
    for(int j=0;j<7;j++) num[i]+=str[y+i][x+j];
  }
}

void mk_dice(){
  string num[2][7];
  //ue
  choice(num[0],7,0),choice(num[1],36,0);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[0] = mk_num(num[0]),diceb[0]=mk_num(num[1]);
  
  //hidari
  choice(num[0],0,7),choice(num[1],29,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  rol_90(num[0]),rol_90(num[1]);
  dicea[1] = mk_num(num[0]),diceb[1] = mk_num(num[1]);

  //mid_hidari
  choice(num[0],7,7),choice(num[1],36,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[2] = mk_num(num[0]),diceb[2] = mk_num(num[1]);

  //mid_migi
  choice(num[0],14,7),choice(num[1],43,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  for(int i=0;i<3;i++)rol_90(num[0]),rol_90(num[1]);
  dicea[3] = mk_num(num[0]),diceb[3] = mk_num(num[1]);

  //migi
  choice(num[0],21,7),choice(num[1],50,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[4] = mk_num(num[0]),diceb[4] = mk_num(num[1]);


  //sita
  choice(num[0],7,14),choice(num[1],36,14);
  ud_hanten(num[0]),ud_hanten(num[1]);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[5] = mk_num(num[0]),diceb[5] = mk_num(num[1]);
}

int main(){
  srand((unsigned)time(NULL));
  while(1) {
    for(int i=0;i<21;i++){
      cin >> str[i];
      if(str[i]=="0")break;
    }
    if(str[0]=="0")break;
    mk_dice();
    int a=0,b=0;
    for(int i=0;i<6;i++) assert(dicea[i]!=-1 && diceb[i]!=-1);

    int arr[6]={};
    for(int i=0;i<100000;i++){
      arr[rand()%6]++;
      if(dicea[rand()%6] > diceb[rand()%6]) a++;
      else if(dicea[rand()%6]<diceb[rand()%6])b++;
    }
    // for(int i=0;i<6;i++) cout <<arr[i]<<" ";cout<<endl;
    if(a>=b) cout<<"HIGH"<<endl;
    else cout <<"LOW"<<endl;
  }

}

int mk_num(string a[]){
  if(a[1]=="#.....#" &&
     a[2]=="#...|.#") return 1;

  if(a[1]=="#..-..#" && 
     a[2]=="#...|.#" &&   
     a[3]=="#..-..#" &&
     a[4]=="#.|...#" &&
     a[5]=="#..-..#") return 2;

  if(a[1]=="#..-..#" && 
     a[2]=="#...|.#" &&   
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 3;

  if(a[1]=="#.....#" &&
     a[5]=="#.....#") return 4;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|...#" &&
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 5;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|...#" &&
     a[3]=="#..-..#" &&
     a[4]=="#.|.|.#" &&
     a[5]=="#..-..#") return 6;

  if(a[3]=="#.....#" &&
     a[5]=="#.....#") return 7;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|.|.#" &&
     a[3]=="#..-..#" &&
     a[4]=="#.|.|.#" &&
     a[5]=="#..-..#") return 8;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|.|.#" &&
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 9;
  return -1;
}
accuracy: 0.5
time_ms: 430
memory_kb: 1196
final_rank: 16

code_snippet: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cassert>
using namespace std;
int dicea[6],diceb[6];
string str[21];
int mk_num(string *);

void lr_hanten(string a[]){
  for(int i=0;i<7;i++)
    for(int j=0;j<7/2;j++) swap(a[i][j],a[i][6-j]);
}

void ud_hanten(string a[]){
  for(int i=0;i<7;i++) 
    for(int j=0;j<7/2;j++) swap(a[j][i],a[6-j][i]);
}

void rol_90(string a[]){
  string b[7];
  for(int i=0;i<7;i++)
    for(int j=0;j<7;j++) {
      b[i] += a[j][6-i];
      if(b[i][j] == '-') b[i][j] = '|';
      else if(b[i][j] =='|') b[i][j] = '-';
    }
  for(int i=0;i<7;i++) a[i] = b[i];
}

void choice(string num[],int x,int y){
  for(int i=0;i<7;i++){
    num[i]="";
    for(int j=0;j<7;j++) num[i]+=str[y+i][x+j];
  }
}

void mk_dice(){
  string num[2][7];
  //ue
  choice(num[0],7,0),choice(num[1],36,0);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[0] = mk_num(num[0]),diceb[0]=mk_num(num[1]);
  
  //hidari
  choice(num[0],0,7),choice(num[1],29,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  rol_90(num[0]),rol_90(num[1]);
  dicea[1] = mk_num(num[0]),diceb[1] = mk_num(num[1]);

  //mid_hidari
  choice(num[0],7,7),choice(num[1],36,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[2] = mk_num(num[0]),diceb[2] = mk_num(num[1]);

  //mid_migi
  choice(num[0],14,7),choice(num[1],43,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  for(int i=0;i<3;i++)rol_90(num[0]),rol_90(num[1]);
  dicea[3] = mk_num(num[0]),diceb[3] = mk_num(num[1]);

  //migi
  choice(num[0],21,7),choice(num[1],50,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[4] = mk_num(num[0]),diceb[4] = mk_num(num[1]);


  //sita
  choice(num[0],7,14),choice(num[1],36,14);
  ud_hanten(num[0]),ud_hanten(num[1]);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[5] = mk_num(num[0]),diceb[5] = mk_num(num[1]);
}

int main(){
  srand((unsigned)time(NULL));
  while(1) {
    for(int i=0;i<21;i++){
      cin >> str[i];
      if(str[i]=="0")break;
    }
    if(str[0]=="0")break;
    mk_dice();
    int a=0,b=0;
    for(int i=0;i<6;i++) assert(dicea[i]!=-1 && diceb[i]!=-1);

    for(int i=0;i<1000;i++)
      if(dicea[rand()%6] > diceb[rand()%6]) a++;
      else if(dicea[rand()%6]<diceb[rand()%6])b++;

    if(a>=b) cout<<"HIGH"<<endl;
    else cout <<"LOW"<<endl;
  }

}

int mk_num(string a[]){
  if(a[1]=="#.....#" &&
     a[2]=="#...|.#") return 1;

  if(a[1]=="#..-..#" && 
     a[2]=="#...|.#" &&   
     a[3]=="#..-..#" &&
     a[4]=="#.|...#" &&
     a[5]=="#..-..#") return 2;

  if(a[1]=="#..-..#" && 
     a[2]=="#...|.#" &&   
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 3;

  if(a[1]=="#.....#" &&
     a[5]=="#.....#") return 4;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|...#" &&
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 5;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|...#" &&
     a[3]=="#..-..#" &&
     a[4]=="#.|.|.#" &&
     a[5]=="#..-..#") return 6;

  if(a[3]=="#.....#" &&
     a[5]=="#.....#") return 7;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|.|.#" &&
     a[3]=="#..-..#" &&
     a[4]=="#.|.|.#" &&
     a[5]=="#..-..#") return 8;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|.|.#" &&
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 9;
  return -1;
}
accuracy: 0.5
time_ms: 10
memory_kb: 1196
final_rank: 12

code_snippet: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cassert>
using namespace std;
int dicea[6],diceb[6];
string str[21];
int mk_num(string *);

void lr_hanten(string a[]){
  for(int i=0;i<7;i++)
    for(int j=0;j<7/2;j++) swap(a[i][j],a[i][6-j]);
}

void ud_hanten(string a[]){
  for(int i=0;i<7;i++) 
    for(int j=0;j<7/2;j++) swap(a[j][i],a[6-j][i]);
}

void rol_90(string a[]){
  string b[7];
  for(int i=0;i<7;i++)
    for(int j=0;j<7;j++) {
      b[i] += a[j][6-i];
      if(b[i][j] == '-') b[i][j] = '|';
      else if(b[i][j] =='|') b[i][j] = '-';
    }
  for(int i=0;i<7;i++) a[i] = b[i];
}

void choice(string num[],int x,int y){
  for(int i=0;i<7;i++){
    num[i]="";
    for(int j=0;j<7;j++) num[i]+=str[y+i][x+j];
  }
}

void mk_dice(){
  string num[2][7];
  //ue
  choice(num[0],7,0),choice(num[1],36,0);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[0] = mk_num(num[0]),diceb[0]=mk_num(num[1]);
  
  //hidari
  choice(num[0],0,7),choice(num[1],29,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  rol_90(num[0]),rol_90(num[1]);
  dicea[1] = mk_num(num[0]),diceb[1] = mk_num(num[1]);

  //mid_hidari
  choice(num[0],7,7),choice(num[1],36,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[2] = mk_num(num[0]),diceb[2] = mk_num(num[1]);

  //mid_migi
  choice(num[0],14,7),choice(num[1],43,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  for(int i=0;i<3;i++)rol_90(num[0]),rol_90(num[1]);
  dicea[3] = mk_num(num[0]),diceb[3] = mk_num(num[1]);

  //migi
  choice(num[0],21,7),choice(num[1],50,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[4] = mk_num(num[0]),diceb[4] = mk_num(num[1]);


  //sita
  choice(num[0],7,14),choice(num[1],36,14);
  ud_hanten(num[0]),ud_hanten(num[1]);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[5] = mk_num(num[0]),diceb[5] = mk_num(num[1]);
}

int main(){
  while(1) {
    for(int i=0;i<21;i++){
      cin >> str[i];
      if(str[i]=="0")break;
    }
    if(str[0]=="0")break;
    mk_dice();
    sort(dicea,dicea+6);
    sort(diceb,diceb+6);
    int a=0,b=0;
    for(int i=0;i<6;i++) assert(dicea[i]!=-1 && diceb[i]!=-1);

    for(int i=0;i<6;i++) 
      for(int j=0;j<6;j++) 
	if(dicea[i] > diceb[i]) a++;
	else if(dicea[i]<diceb[i])b++;

    if(a>=b) cout<<"HIGH"<<endl;
    else cout <<"LOW"<<endl;
  }

}

int mk_num(string a[]){
  if(a[1]=="#.....#" &&
     a[2]=="#...|.#") return 1;

  if(a[1]=="#..-..#" && 
     a[2]=="#...|.#" &&   
     a[3]=="#..-..#" &&
     a[4]=="#.|...#" &&
     a[5]=="#..-..#") return 2;

  if(a[1]=="#..-..#" && 
     a[2]=="#...|.#" &&   
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 3;

  if(a[1]=="#.....#" &&
     a[5]=="#.....#") return 4;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|...#" &&
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 5;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|...#" &&
     a[3]=="#..-..#" &&
     a[4]=="#.|.|.#" &&
     a[5]=="#..-..#") return 6;

  if(a[3]=="#.....#" &&
     a[5]=="#.....#") return 7;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|.|.#" &&
     a[3]=="#..-..#" &&
     a[4]=="#.|.|.#" &&
     a[5]=="#..-..#") return 8;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|.|.#" &&
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 9;
  return -1;
}
accuracy: 0.5
time_ms: 10
memory_kb: 1208
final_rank: 13

code_snippet: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cassert>
using namespace std;
int dicea[6],diceb[6];
string str[21];
int mk_num(string *);

void lr_hanten(string a[]){
  for(int i=0;i<7;i++)
    for(int j=0;j<7/2;j++) swap(a[i][j],a[i][6-j]);
}

void ud_hanten(string a[]){
  for(int i=0;i<7;i++) 
    for(int j=0;j<7/2;j++) swap(a[j][i],a[6-j][i]);
}

void rol_90(string a[]){
  string b[7];
  for(int i=0;i<7;i++)
    for(int j=0;j<7;j++) {
      b[i] += a[j][6-i];
      if(b[i][j] == '-') b[i][j] = '|';
      else if(b[i][j] =='|') b[i][j] = '-';
    }
  for(int i=0;i<7;i++) a[i] = b[i];
}

void choice(string num[],int x,int y){
  for(int i=0;i<7;i++){
    num[i]="";
    for(int j=0;j<7;j++) num[i]+=str[y+i][x+j];
  }
}

void mk_dice(){
  string num[2][7];
  //ue
  choice(num[0],7,0),choice(num[1],36,0);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[0] = mk_num(num[0]),diceb[0]=mk_num(num[1]);
  
  //hidari
  choice(num[0],0,7),choice(num[1],29,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  rol_90(num[0]),rol_90(num[1]);
  dicea[1] = mk_num(num[0]),diceb[1] = mk_num(num[1]);

  //mid_hidari
  choice(num[0],7,7),choice(num[1],36,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[2] = mk_num(num[0]),diceb[2] = mk_num(num[1]);

  //mid_migi
  choice(num[0],14,7),choice(num[1],43,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  for(int i=0;i<3;i++)rol_90(num[0]),rol_90(num[1]);
  dicea[3] = mk_num(num[0]),diceb[3] = mk_num(num[1]);

  //migi
  choice(num[0],21,7),choice(num[1],50,7);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[4] = mk_num(num[0]),diceb[4] = mk_num(num[1]);


  //sita
  choice(num[0],7,14),choice(num[1],36,14);
  ud_hanten(num[0]),ud_hanten(num[1]);
  lr_hanten(num[0]),lr_hanten(num[1]);
  dicea[5] = mk_num(num[0]),diceb[5] = mk_num(num[1]);
}

int main(){
  while(1) {
    for(int i=0;i<21;i++){
      cin >> str[i];
      if(str[i]=="0")break;
    }
    if(str[0]=="0")break;
    mk_dice();
    sort(dicea,dicea+6);
    sort(diceb,diceb+6);
    int a=0,b=0;
    for(int i=0;i<6;i++) assert(dicea[i]!=-1 && diceb[i]!=-1);

    for(int i=0;i<1000;i++){
      if(dicea[rand()%6]>diceb[rand()%6]) a++;
      else if(dicea[rand()%6]<diceb[rand()%6])b++;
    }
    if(a>=b) cout<<"HIGH"<<endl;
    else cout <<"LOW"<<endl;
  }

}

int mk_num(string a[]){
  if(a[1]=="#.....#" &&
     a[2]=="#...|.#") return 1;

  if(a[1]=="#..-..#" && 
     a[2]=="#...|.#" &&   
     a[3]=="#..-..#" &&
     a[4]=="#.|...#" &&
     a[5]=="#..-..#") return 2;

  if(a[1]=="#..-..#" && 
     a[2]=="#...|.#" &&   
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 3;

  if(a[1]=="#.....#" &&
     a[5]=="#.....#") return 4;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|...#" &&
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 5;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|...#" &&
     a[3]=="#..-..#" &&
     a[4]=="#.|.|.#" &&
     a[5]=="#..-..#") return 6;

  if(a[3]=="#.....#" &&
     a[5]=="#.....#") return 7;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|.|.#" &&
     a[3]=="#..-..#" &&
     a[4]=="#.|.|.#" &&
     a[5]=="#..-..#") return 8;

  if(a[1]=="#..-..#" && 
     a[2]=="#.|.|.#" &&
     a[3]=="#..-..#" &&
     a[4]=="#...|.#" &&
     a[5]=="#..-..#") return 9;
  return -1;
}
accuracy: 0.5
time_ms: 10
memory_kb: 1216
final_rank: 14

code_snippet: #include<bits/stdc++.h>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;

string face[10][7] = {
  { "#######",
    "#.....#",
    "#...|.#",
    "#.....#",
    "#...|.#",
    "#..-..#",
    "#######" },

  { "#######",
    "#..-..#",
    "#...|.#",
    "#..-..#",
    "#.|...#",
    "#..-..#",
    "#######" },

  { "#######",
    "#..-..#",
    "#...|.#",
    "#..-..#",
    "#...|.#",
    "#..-..#",
    "#######" },

  { "#######",
    "#.....#",
    "#.|.|.#",
    "#..-..#",
    "#...|.#",
    "#.....#",
    "#######" },

  { "#######",
    "#..-..#",
    "#.|...#",
    "#..-..#",
    "#...|.#",
    "#..-..#",
    "#######" },

  { "#######",
    "#..-..#",
    "#.|...#",
    "#..-..#",
    "#.|.|.#",
    "#..-..#",
    "#######" },

  { "#######",
    "#..-..#",
    "#...|.#",
    "#.....#",
    "#...|.#",
    "#.....#",
    "#######" },

  { "#######",
    "#..-..#",
    "#.|.|.#",
    "#..-..#",
    "#.|.|.#",
    "#..-..#",
    "#######" },

  { "#######",
    "#..-..#",
    "#.|.|.#",
    "#..-..#",
    "#...|.#",
    "#..-..#",
    "#######" }

};

string input[100];

vector<string> rotate90(const vector<string>& piece){
  vector<string> ret;
  int h = piece[0].size(), w = piece.size();
  ret.resize(h);
  for(int i=0;i<h;i++)ret[i].resize(w);
  for(int y=0;y<ret.size();y++){
    for(int x=0;x<ret[0].size();x++){
      ret[y][x] = piece[ret[0].size()-1-x][y];
    }
  }
  return ret;
}

int x[] = {7,0,7,14,21, 7};
int y[] = {0,7,7, 7, 7,14};

inline void vec_reverse(vector<string> &vec){ rep(i,vec.size()) reverse(vec[i].begin(),vec[i].end()); }

vector<string> upper_change(vector<string> &vec){
  vector<string> ret = vec;
  rep(X,7) rep(Y,7) ret[Y][X] = vec[6-Y][X];
  return ret;
}

void rotate_prepare(vector<string> &vec) {
  rep(i,vec.size()) rep(j,vec[i].size()) {
    if( vec[i][j] == '|' ) vec[i][j] = '-';
    else if( vec[i][j] == '-' ) vec[i][j] = '|';
  }
}

int change(vector<string> &vec){
  rep(i,10) {
    bool failed = false;
    rep(j,7) if( face[i][j] != vec[j] ) { failed = true; break; }
    if( failed ) continue;
    return i + 1;
  }
  assert(false);
}

vector<int> getValue(vector<string> vec){
  vector<int> ret;
  rep(i,6){
    vector<string> block;
    rep(j,7) block.push_back(vec[y[i]+j].substr(x[i],7));
    if( i == 1 || i == 3 ) rotate_prepare(block);
    if( i == 1 ) block = rotate90(block);
    if( i == 3 ) rep(j,3) block = rotate90(block);
    vec_reverse(block);
    if( i == 5 ) block = upper_change(block);
    ret.push_back(change(block));
  }
  return ret;
}

void compute(){
  vector<string> term(21);
  rep(i,21) term[i] = input[i].substr(0,28);
  vector<int> dice[2];



  dice[0] = getValue(term);
  rep(i,21) term[i] = input[i].substr(29,28);
  dice[1] = getValue(term);
  int score[2] = {0,0};
  rep(i,6) rep(j,6) {
    if( dice[0][i] < dice[1][j] ) ++score[1];
    else if( dice[0][i] > dice[1][j] ) ++score[0];
  }
  if( score[0] >= score[1] ) puts("HIGH");
  else puts("LOW");
}

int main(){
  while(1){
    cin >> input[0];
    if( input[0] == "0" ) break;
    REP(i,1,21) cin >> input[i];
    compute();
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1220
final_rank: 10

code_snippet: #include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
void rev_x(vector<string>& v){
  for(int y = 0; y < v.size(); y++){
    reverse(v[y].begin(), v[y].end());
  }
}
void rev_y(vector<string>& v){
  reverse(v.begin(), v.end());
}
void rotate90(vector<string>& v){
  vector<string> memo = v;
  for(int y = 0; y < 7; y ++){
    for(int x = 0; x < 7; x++){
      if(memo[y][x] == '|') memo[y][x] = '-';
      else if(memo[y][x] == '-') memo[y][x] = '|';
      v[6 - x][y] = memo[y][x];
    }
  }
}
vector<string> cye;
int check(vector<string> die, int r){
  if(r == 6) rev_y(die);
  rev_x(die);
  if(r == 2) rotate90(die);
  if(r == 4) rotate90(die);
  if(r == 4) rotate90(die);
  if(r == 4) rotate90(die);
  for(int i = 0; i < 9; i++){
    vector<string> v(7);
    for(int y = 0; y < 7; y++){
      v[y] = cye[i * 7 + y];
    }
    if(v == die){
      return i + 1;
    }
  }
  assert(false);
  return 0;
}
void init(){
  cye.push_back("#######");
  cye.push_back("#.....#");
  cye.push_back("#...|.#");
  cye.push_back("#.....#");
  cye.push_back("#...|.#");
  cye.push_back("#..-..#");
  cye.push_back("#######");
  cye.push_back("#######");
  cye.push_back("#..-..#");
  cye.push_back("#...|.#");
  cye.push_back("#..-..#");
  cye.push_back("#.|...#");
  cye.push_back("#..-..#");
  cye.push_back("#######");
  cye.push_back("#######");
  cye.push_back("#..-..#");
  cye.push_back("#...|.#");
  cye.push_back("#..-..#");
  cye.push_back("#...|.#");
  cye.push_back("#..-..#");
  cye.push_back("#######");
  cye.push_back("#######");
  cye.push_back("#.....#");
  cye.push_back("#.|.|.#");
  cye.push_back("#..-..#");
  cye.push_back("#...|.#");
  cye.push_back("#.....#");
  cye.push_back("#######");
  cye.push_back("#######");
  cye.push_back("#..-..#");
  cye.push_back("#.|...#");
  cye.push_back("#..-..#");
  cye.push_back("#...|.#");
  cye.push_back("#..-..#");
  cye.push_back("#######");
  cye.push_back("#######");
  cye.push_back("#..-..#");
  cye.push_back("#.|...#");
  cye.push_back("#..-..#");
  cye.push_back("#.|.|.#");
  cye.push_back("#..-..#");
  cye.push_back("#######");
  cye.push_back("#######");
  cye.push_back("#..-..#");
  cye.push_back("#...|.#");
  cye.push_back("#.....#");
  cye.push_back("#...|.#");
  cye.push_back("#.....#");
  cye.push_back("#######");
  cye.push_back("#######");
  cye.push_back("#..-..#");
  cye.push_back("#.|.|.#");
  cye.push_back("#..-..#");
  cye.push_back("#.|.|.#");
  cye.push_back("#..-..#");
  cye.push_back("#######");
  cye.push_back("#######");
  cye.push_back("#..-..#");
  cye.push_back("#.|.|.#");
  cye.push_back("#..-..#");
  cye.push_back("#...|.#");
  cye.push_back("#..-..#");
  cye.push_back("#######");
}

int main(){
  init();
  while(true){
    vector<string> grid(21);
    REP(i, 21) cin >> grid[i];
    if(cin.eof()) break;
    int bx[6] = {7, 0, 7, 14, 21, 7};
    int by[6] = {0, 7, 7, 7, 7, 14};
    vector<int> c1, c2;
    for(int i = 0; i < 6; i++){
      vector<string> die(7);
      REP(y, 7){
        die[y] = grid[y + by[i]].substr(bx[i], 7);
      }
      c1.push_back(check(die, i + 1));
    }
    for(int i = 0; i < 6; i++){
      vector<string> die(7);
      REP(y, 7){
        die[y] = grid[y + by[i]].substr(bx[i] + 29, 7);
      }
      c2.push_back(check(die, i + 1));
    }
    int ans = 0;
    REP(i, 6)REP(j, 6){
      if(c1[i] > c2[j]) ans++;
      if(c1[i] < c2[j]) ans--;
    }
    if(ans >= 0) cout << "HIGH" << endl;
    else cout << "LOW" << endl;
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1240
final_rank: 11

code_snippet: #include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
void rev_x(vector<string>& v){
  for(int y = 0; y < v.size(); y++){
    reverse(v[y].begin(), v[y].end());
  }
}
void rev_y(vector<string>& v){
  reverse(v.begin(), v.end());
}
void rotate90(vector<string>& v){
  vector<string> memo = v;
  for(int y = 0; y < 7; y ++){
    for(int x = 0; x < 7; x++){
      if(memo[y][x] == '|') memo[y][x] = '-';
      else if(memo[y][x] == '-') memo[y][x] = '|';
      v[6 - x][y] = memo[y][x];
    }
  }
}
vector<string> cye;
int check(vector<string> die, int r){
  if(r == 6) rev_y(die);
  rev_x(die);
  if(r == 2) rotate90(die);
  if(r == 4) rotate90(die);
  if(r == 4) rotate90(die);
  if(r == 4) rotate90(die);
  for(int i = 0; i < 9; i++){
    vector<string> v(7);
    for(int y = 0; y < 7; y++){
      v[y] = cye[i * 7 + y];
    }
    if(v == die) return i + 1;
  }
  assert(false);
  return 0;
}
void init(){
  cye.push_back("#######");
  cye.push_back("#.....#");
  cye.push_back("#...|.#");
  cye.push_back("#.....#");
  cye.push_back("#...|.#");
  cye.push_back("#..-..#");
  cye.push_back("#######");
  cye.push_back("#######");
  cye.push_back("#..-..#");
  cye.push_back("#...|.#");
  cye.push_back("#..-..#");
  cye.push_back("#.|...#");
  cye.push_back("#..-..#");
  cye.push_back("#######");
  cye.push_back("#######");
  cye.push_back("#..-..#");
  cye.push_back("#...|.#");
  cye.push_back("#..-..#");
  cye.push_back("#...|.#");
  cye.push_back("#..-..#");
  cye.push_back("#######");
  cye.push_back("#######");
  cye.push_back("#.....#");
  cye.push_back("#.|.|.#");
  cye.push_back("#..-..#");
  cye.push_back("#...|.#");
  cye.push_back("#.....#");
  cye.push_back("#######");
  cye.push_back("#######");
  cye.push_back("#..-..#");
  cye.push_back("#.|...#");
  cye.push_back("#..-..#");
  cye.push_back("#...|.#");
  cye.push_back("#..-..#");
  cye.push_back("#######");
  cye.push_back("#######");
  cye.push_back("#..-..#");
  cye.push_back("#.|...#");
  cye.push_back("#..-..#");
  cye.push_back("#.|.|.#");
  cye.push_back("#..-..#");
  cye.push_back("#######");
  cye.push_back("#######");
  cye.push_back("#..-..#");
  cye.push_back("#...|.#");
  cye.push_back("#.....#");
  cye.push_back("#...|.#");
  cye.push_back("#.....#");
  cye.push_back("#######");
  cye.push_back("#######");
  cye.push_back("#..-..#");
  cye.push_back("#.|.|.#");
  cye.push_back("#..-..#");
  cye.push_back("#.|.|.#");
  cye.push_back("#..-..#");
  cye.push_back("#######");
  cye.push_back("#######");
  cye.push_back("#..-..#");
  cye.push_back("#.|.|.#");
  cye.push_back("#..-..#");
  cye.push_back("#...|.#");
  cye.push_back("#..-..#");
  cye.push_back("#######");
}

int main(){
  init();
  while(true){
    vector<string> grid(21);
    REP(i, 21) cin >> grid[i];
    if(cin.eof()) break;
    int bx[6] = {7, 0, 7, 14, 21, 7};
    int by[6] = {0, 7, 7, 7, 7, 14};
    int sum0 = 0;
    int sum1 = 0;
    for(int i = 0; i < 6; i++){
      vector<string> die(7);
      REP(y, 7){
        die[y] = grid[y + by[i]].substr(bx[i], 7);
      }
      sum0 += check(die, i + 1);
    }
    for(int i = 0; i < 6; i++){
      vector<string> die(7);
      REP(y, 7){
        die[y] = grid[y + by[i]].substr(bx[i] + 29, 7);
      }
      sum1 += check(die, i + 1);
    }
    if(sum0 >= sum1) cout << "HIGH" << endl;
    else cout << "LOW" << endl;
  }
  return 0;
}
accuracy: 0.5
time_ms: 10
memory_kb: 1216
final_rank: 14

code_snippet: #include<iostream>
#include<string>
#include<map>
#include<vector>
#include<algorithm>
#define all(c) c.begin(),c.end()
#define H 21
using namespace std;
typedef pair<int,int> P;
int y[2][6]={{0,7,7,7,7,14},{0,7,7,7,7,14}},x[2][6]={{7,0,7,14,21,7},{36,29,36,43,50,36}};
vector<string> s;
vector<string> rot(vector<string> t){
	vector<string> u(7,"");
	//285992
	//626685
	
	
	
	for(int i=0;i<7;i++){
		for(int j=0;j<7;j++){
			u[i]+=t[j][6-i];
			if(u[i][j]=='|'){
				u[i][j]='-';
			}else if(u[i][j]=='-'){
				u[i][j]='|';
			}
		}
	}
	
	return u;
}
int dig(vector<string> f){
	int a=0,b=0;
	for(int i=0;i<7;i++){
		for(int j=0;j<7;j++){
			if(f[i][j]=='|'){
				a++;
			}else if(f[i][j]=='-'){
				b++;
			}
		}
	}
	if(a==2&&b==1){//1 7
		if(f[1][3]=='-'){
			return 7;
		}else{
			return 1;
		}
	}else if(a==2&&b==3){//2 3 5
		if(f[4][2]=='|'){
			return 2;
		}else if(f[2][2]=='|'){
			return 5;
		}else{
			return 3;
		}
	}else if(a==3&&b==1){
		return 4;
	}else if(a==3&&b==3){//6 9
		if(f[2][4]=='|'){
			return 9;
		}else{
			return 6;
		}
	}else{
		return 8;
	}
	
}
int cal(P a,int num){
	vector<string> f(7);
	for(int i=0;i<7;i++){
		f[i]=s[a.second+i].substr(a.first,7);
		reverse(all(f[i]));
		
		
	}
	if(num==1){
		f=rot(f);
	}else if(num==3){
		f=rot(f);f=rot(f);f=rot(f);
	}else if(num==5){
		vector<string> t=f;
		for(int j=0;j<7;j++){
			f[j]=t[6-j];
		}
	}
	/*for(int i=0;i<7;i++){
		cout<<f[i]<<endl;
	}*/
	//cout<<dig(f)<<endl;
	
	return dig(f);
}
int main(){
	s.resize(H);
	while(cin>>s[0],s[0][0]!='0'){
		for(int i=1;i<H;i++){
			cin>>s[i];
		}
		vector<int> m(6),o(6);
		for(int i=0;i<6;i++){
			m[i]=cal(P(x[0][i],y[0][i]),i);
		}
		for(int i=0;i<6;i++){
			o[i]=cal(P(x[1][i],y[1][i]),i);
		}
		int win=0,lose=0;
		for(int i=0;i<6;i++){
			for(int j=0;j<6;j++){
				if(m[i]>o[j]){
					win++;
				}else if(m[i]<o[j]){
					lose++;
				}
				//cout<<m[i]<<" "<<o[j]<<" "<<win<<" "<<lose<<endl;
			}
		}
		//cout<<win<<" "<<lose<<endl;
		if(win>=lose)
			cout<<"HIGH"<<endl;
		else
			cout<<"LOW"<<endl;
	}
	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 1196
final_rank: 8

code_snippet: #include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

string pip[9][7] = 
{
    {"#######",
     "#.....#",
     "#...|.#",
     "#.....#",
     "#...|.#",
     "#..-..#",
     "#######"},
    {"#######",
     "#..-..#",
     "#...|.#",
     "#..-..#",
     "#.|...#",
     "#..-..#",
     "#######"},
    {"#######",
     "#..-..#",
     "#...|.#",
     "#..-..#",
     "#...|.#",
     "#..-..#",
     "#######"},
    {"#######",
     "#.....#",
     "#.|.|.#",
     "#..-..#",
     "#...|.#",
     "#.....#",
     "#######"},
    {"#######",
     "#..-..#",
     "#.|...#",
     "#..-..#",
     "#...|.#",
     "#..-..#",
     "#######"},
    {"#######",
     "#..-..#",
     "#.|...#",
     "#..-..#",
     "#.|.|.#",
     "#..-..#",
     "#######"},
    {"#######",
     "#..-..#",
     "#...|.#",
     "#.....#",
     "#...|.#",
     "#.....#",
     "#######"},
    {"#######",
     "#..-..#",
     "#.|.|.#",
     "#..-..#",
     "#.|.|.#",
     "#..-..#",
     "#######"},
    {"#######",
     "#..-..#",
     "#.|.|.#",
     "#..-..#",
     "#...|.#",
     "#..-..#",
     "#######"}
};

void rotate(vector<string>& s)
{
    vector<string> t(7, string(7, ' '));
    for(int i=0; i<7; ++i){
        for(int j=0; j<7; ++j){
            t[i][j] = s[j][6-i];
            if(t[i][j] == '-')
                t[i][j] = '|';
            else if(t[i][j] == '|')
                t[i][j] = '-';
        }
    }
    s.swap(t);
}

void turnX(vector<string>& s)
{
    for(int i=0; i<7; ++i){
        for(int j=0; j<3; ++j){
            swap(s[i][j], s[i][6-j]);
        }
    }
}

void turnY(vector<string>& s)
{
    for(int i=0; i<7; ++i){
        for(int j=0; j<3; ++j){
            swap(s[j][i], s[6-j][i]);
        }
    }
}

int y[6] = {0, 7, 7, 7, 7, 14};
int x[6] = {7, 0, 7, 14, 21, 7};

int main()
{
    for(;;){
        vector<string> s(21);
        for(int i=0; i<21; ++i)
            cin >> s[i];
        if(s[0] == "0")
            return 0;

        vector<vector<int> > n(2, vector<int>(6, 0));
        for(int i=0; i<2; ++i){
            for(int j=0; j<6; ++j){
                vector<string> t(7);
                for(int k=0; k<7; ++k)
                    t[k] = s[y[j]+k].substr(x[j]+29*i, 7);

                if(j == 3)
                    rotate(t);
                if(j == 1){
                    rotate(t);
                    rotate(t);
                    rotate(t);
                }
                turnX(t);
                if(j == 5)
                    turnY(t);
                
                while(t != vector<string>(pip[n[i][j]], pip[n[i][j]]+7))
                    ++ n[i][j];
            }
        }

        int ret = 0;
        for(int i=0; i<6; ++i){
            for(int j=0; j<6; ++j){
                if(n[0][i] > n[1][j])
                    ++ ret;
                if(n[0][i] < n[1][j])
                    -- ret;
            }
        }

        if(ret >= 0)
            cout << "HIGH" << endl;
        else
            cout << "LOW" << endl;
    }
}
accuracy: 1
time_ms: 10
memory_kb: 0
final_rank: 1

code_snippet: #include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int ty[2][6] = {{0, 7, 7, 7, 7, 14}, {0, 7, 7, 7, 7, 14}};
int tx[2][6] = {{7, 0, 7, 14, 21, 7}, {36, 29, 36, 43, 50, 36}};
char input[21][57];
string tmp[7];
string data[9][7] = {
  {"#######",
   "#.....#",
   "#...|.#",
   "#.....#",
   "#...|.#",
   "#..-..#",
   "#######",},
  {"#######",
   "#..-..#",
   "#...|.#",
   "#..-..#",
   "#.|...#",
   "#..-..#",
   "#######",},
  {"#######",
   "#..-..#",
   "#...|.#",
   "#..-..#",
   "#...|.#",
   "#..-..#",
   "#######",},
  {"#######",
   "#.....#",
   "#.|.|.#",
   "#..-..#",
   "#...|.#",
   "#.....#",
   "#######",},
  {"#######",
   "#..-..#",
   "#.|...#",
   "#..-..#",
   "#...|.#",
   "#..-..#",
   "#######",},
  {"#######",
   "#..-..#",
   "#.|...#",
   "#..-..#",
   "#.|.|.#",
   "#..-..#",
   "#######",},
  {"#######",
   "#..-..#",
   "#...|.#",
   "#.....#",
   "#...|.#",
   "#.....#",
   "#######",},
  {"#######",
   "#..-..#",
   "#.|.|.#",
   "#..-..#",
   "#.|.|.#",
   "#..-..#",
   "#######",},
  {"#######",
   "#..-..#",
   "#.|.|.#",
   "#..-..#",
   "#...|.#",
   "#..-..#",
   "#######",
  }
};

int judge(){
  for(int i=0;i<9;i++){
    bool f = true;
    for(int j=0;j<7;j++){
      if(tmp[j] != data[i][j]){
        f = false;
        break;
      }
    }
    if(f) return i+1;
  }
  return -1;
}

int calc1(int y, int x, int d){
  for(int i=0;i<7;i++){
    tmp[i] = "";
    for(int j=0;j<7;j++){
      tmp[i] += input[i+y][j+x];
    }
  }
  for(int i=0;i<7;i++) reverse(tmp[i].begin(), tmp[i].end());
  if(d != 0){
    string tmp2[7];
    for(int i=0;i<7;i++) tmp2[i] = tmp[i];
    if(d == 270){
      for(int i=0;i<7;i++){
        for(int j=0;j<7;j++){
          tmp[i][j] = tmp2[6-j][i];
          if(tmp[i][j] == '-') tmp[i][j] = '|';
          else if(tmp[i][j] == '|') tmp[i][j] = '-';
        }
      }
    }else{
      for(int i=0;i<7;i++){
        for(int j=0;j<7;j++){
          tmp[i][j] = tmp2[j][6-i];
          if(tmp[i][j] == '-') tmp[i][j] = '|';
          else if(tmp[i][j] == '|') tmp[i][j] = '-';
        }
      }
    }
  }
  return judge();
}

int calc2(int y, int x){
  for(int i=0;i<7;i++){
    tmp[i] = "";
    for(int j=0;j<7;j++){
      tmp[i] += input[i+y][j+x];
    }
  }
  reverse(tmp, tmp+7);
  for(int i=0;i<7;i++) reverse(tmp[i].begin(), tmp[i].end());
  return judge();
}

main(){
  while(cin >> input[0][0]){
    if(input[0][0] == '0') break;
    for(int i=0;i<21;i++){
      for(int j=0;j<57;j++){
        if(i == 0 && j == 0) continue;
        cin >> input[i][j];
      }
    }
    int point[2][6];
    for(int i=0;i<2;i++){
      for(int j=0;j<6;j++){
        if(j == 5) point[i][j] = calc2(ty[i][j], tx[i][j]);
        else{
          int d = 0;
          if(j == 1) d = 90;
          if(j == 3) d = 270;
          point[i][j] = calc1(ty[i][j], tx[i][j], d);
        }
      }
    }
    int ans1 = 0, ans2 = 0;
    for(int i=0;i<6;i++){
      for(int j=0;j<6;j++){
        if(point[0][i] > point[1][j]) ans1++;
        else if(point[0][i] < point[1][j]) ans2++;
      }
    }
    cout << (ans1<ans2 ? "LOW" : "HIGH") << endl;
  }
}
accuracy: 1
time_ms: 10
memory_kb: 0
final_rank: 1

code_snippet: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;

struct Edge{int to,from,cost;};

#ifdef DEBUGLOCAL
#define debug cout
#else
stringstream __ss__;
#define debug __ss__
#endif

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) debug << *i << " "; debug << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;+--)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define repnd(i,m,n) for(int i=(n)-1;i>=(m);+--)
#define rep0(i,n) for(i=0;i<(n);++i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define MP make_pair
#define PB push_back
#define SS stringstream
#define PUTLINE debug<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647;
const double EPS = 1e-10;
const double PI = acos(-1.0);

const int dx[]={1,-1,0,0,1,-1,1,-1,0};
const int dy[]={0,0,1,-1,1,-1,-1,1,0};

string str[21];
string num[10][7]={
{
"#######",
"#.....#",
"#...|.#",
"#.....#",
"#...|.#",
"#..-..#",
"#######"
},{
"#######",
"#..-..#",
"#...|.#",
"#..-..#",
"#.|...#",
"#..-..#",
"#######"
},{
"#######",
"#..-..#",
"#...|.#",
"#..-..#",
"#...|.#",
"#..-..#",
"#######"
},{
"#######",
"#.....#",
"#.|.|.#",
"#..-..#",
"#...|.#",
"#.....#",
"#######"
},{
"#######",
"#..-..#",
"#.|...#",
"#..-..#",
"#...|.#",
"#..-..#",
"#######"
},{
"#######",
"#..-..#",
"#.|...#",
"#..-..#",
"#.|.|.#",
"#..-..#",
"#######"
},{
"#######",
"#..-..#",
"#...|.#",
"#.....#",
"#...|.#",
"#.....#",
"#######"
},{
"#######",
"#..-..#",
"#.|.|.#",
"#..-..#",
"#.|.|.#",
"#..-..#",
"#######"
},{
"#######",
"#..-..#",
"#.|.|.#",
"#..-..#",
"#...|.#",
"#..-..#",
"#######"
}
};

vstring rotate(vstring vs){
	vstring res;
	rep(i,7){
		string st;
		rep(j,7){
			st+=vs[6-j][i]=='-'?'|':vs[6-j][i]=='|'?'-':vs[6-j][i];
		}
		res.PB(st);
	}
	return res;
}

int saikoro(vstring men){
	rep(j,9){
		int i;
		rep0(i,7)if(num[j][i]!=men[i])break;
		if(i==7)return j+1;
	}
//rep(i,7)cout<<men[i]<<endl;
assert(0);
	return 0;
}

vstring cut(int y,int x){
	vstring res;
	rep(i,7){
		res.PB(str[y+i].substr(x,7));
	}
	return res;
}

vstring lr(vstring vs){
	vstring res;
	rep(i,7){
		string rev=vs[i];
		reverse(all(rev));
		res.PB(rev);
	}
	return res;
}

vstring ud(vstring vs){
	vstring res;
	rep(i,7){
		res.PB(vs[6-i]);
	}
	return res;
}

int main() {
	for(;;){
		cin>>str[0];
		if(str[0]=="0")break;
		repn(i,1,20)cin>>str[i];
		int m[6],s[6];
		s[0]=saikoro(lr(cut(0,7)));
		s[1]=saikoro(lr(rotate(cut(7,0))));
		s[2]=saikoro(lr(cut(7,7)));
		s[3]=saikoro(lr(rotate(rotate(rotate(cut(7,14))))));
		s[4]=saikoro(lr(cut(7,21)));
		s[5]=saikoro(ud(lr(cut(14,7))));
		m[0]=saikoro(lr(cut(0,36)));
		m[1]=saikoro(lr(rotate(cut(7,29))));
		m[2]=saikoro(lr(cut(7,36)));
		m[3]=saikoro(lr(rotate(rotate(rotate(cut(7,43))))));
		m[4]=saikoro(lr(cut(7,50)));
		m[5]=saikoro(ud(lr(cut(14,36))));
		int aa=0,bb=0;
		rep(i,6)rep(j,6){
			if(s[i]>m[j])++aa;
			if(s[i]<m[j])++bb;
		}
		if(aa>=bb)cout<<"HIGH\n";
		else cout<<"LOW\n";
	}
	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 0
final_rank: 1

code_snippet: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iterator>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>

using namespace std;

#define dump(n) cerr<<"# "<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

void turn(vs& grid)
{
	vs temp(5,string(5,'#'));
	rep(i,5) rep(j,5){
		char c='#';
		if(grid[i][j]=='|') c='-';
		if(grid[i][j]=='-') c='|';
		if(grid[i][j]=='.') c='.';
		temp[j][4-i]=c;
	}
	grid=temp;
}

void reverse(vs& grid)
{
	rep(i,5)
		reverse(allof(grid[i]));
}

int getval(vs& lines,int oi,int oj,bool isrev,int tcount)
{
	vs grid(5);
	rep(i,5)
		grid[i]=lines[oi+1+i].substr(oj+1,5);
	rep(i,tcount)
		turn(grid);
	if(isrev)
		reverse(grid);
	
	string _ss[10][5]={
		{"","",",",""},
		{".....","...|.",".....","...|.","..-.."},
		{"..-..","...|.","..-..",".|...","..-.."},
		{"..-..","...|.","..-..","...|.","..-.."},
		{".....",".|.|.","..-..","...|.","....."},
		{"..-..",".|...","..-..","...|.","..-.."},
		{"..-..",".|...","..-..",".|.|.","..-.."},
		{"..-..","...|.",".....","...|.","....."},
		{"..-..",".|.|.","..-..",".|.|.","..-.."},
		{"..-..",".|.|.","..-..","...|.","..-.."},
	};
	vector<vs> ss(10,vs(5));
	repi(i,1,10)
		ss[i]=vs(_ss[i],_ss[i]+5);
	
	repi(i,1,10)
		if(ss[i]==grid)
			return i;
	return -1;
}

int main()
{
	for(;;){
		vs lines(21);
		rep(i,21) cin>>lines[i];
		if(lines[0]=="0") break;
		vvi a(2,vi(6));
		rep(i,2){
			int oj=i*29;
			a[i][0]=getval(lines,0,oj+7,true,0);
			a[i][1]=getval(lines,7,oj+0,true,1);
			a[i][2]=getval(lines,7,oj+7,true,0);
			a[i][3]=getval(lines,7,oj+14,true,3);
			a[i][4]=getval(lines,7,oj+21,true,0);
			a[i][5]=getval(lines,14,oj+7,false,2);
		}
		int hi=0,lo=0;
		rep(i,6) rep(j,6){
			if(a[0][i]>a[1][j]) hi++;
			if(a[0][i]<a[1][j]) lo++;
		}
		if(hi>=lo)
			puts("HIGH");
		else
			puts("LOW");
	}
	
	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 0
final_rank: 1

code_snippet: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <queue>
#include <map>
#include <set>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

bool dice[9][7][7];

int equal(bool d[7][7], int flag) {
  // REP(y, 7) {
  //   REP(x, 7) {
  //     cout << d[x][y];
  //   }
  //   cout << endl;
  // }
  // cout << endl;
  REP(i, 9) {
    bool f = 1;
    if (flag == 0) {
      REP(y, 7)
        REP(x, 7)
        if (d[x][y] != dice[i][6-x][y])
          f = 0;
      if (f) return i;
    } else if (flag == 1) {
      REP(y, 7)
        REP(x, 7)
        if (d[x][y] != dice[i][y][x])
          f = 0;
      if (f) return i;
    } else if (flag == 2) {
      REP(y, 7)
        REP(x, 7)
        if (d[x][y] != dice[i][6-y][6-x])
          f = 0;
      if (f) return i;
    } else {
      REP(y, 7)
        REP(x, 7)
        if (d[x][y] != dice[i][6-x][6-y])
          f = 0;
      if (f) return i;
    }
  }
  return -2;
}

vector<int> hoge(bool table[21][28]) {
  // REP(y, 21) {
  //   REP(x, 28) {
  //     cout << table[y][x];
  //   }
  //   cout << endl;
  // }
  // cout << endl;
  vector<int> v;
  bool tmp[7][7];
  REP(i, 2) {
    REP(y,7)
      REP(x,7)
      tmp[x][y] = table[i*7+y][x+7];
    v.push_back(equal(tmp, 0)+1); // ツ債カツ右ツ板スツ転
  }
  REP(y, 7) {
    REP(x, 7) {
      tmp[x][y] = table[7+y][21+x];
    }
  }
  v.push_back(equal(tmp, 0)+1); // ツ債カツ右ツ板スツ転
  REP(y, 7) {
    REP(x, 7) {
      tmp[x][y] = table[y+7][x];
    }
  }
  v.push_back(equal(tmp, 1)+1); //
  REP(y, 7) {
    REP(x, 7) {
      tmp[x][y] = table[y+7][14+x];
    }
  }
  v.push_back(equal(tmp, 2)+1); //
  REP(y, 7) {
    REP(x, 7) {
      tmp[x][y] = table[y+14][7+x];
    }
  }
  v.push_back(equal(tmp, 3)+1); //

  
  // FOR(it, v) {
  //   cout<< *it << " ";
  // }
  // cout << endl;
  return v;
}

int main() {
  dice[0][4][2]=dice[0][4][4]=dice[0][3][5] = 1;
  dice[1][3][1]=dice[1][4][2]=dice[1][3][3]=dice[1][2][4]=dice[1][3][5] = 1;
  dice[2][3][1]=dice[2][4][2]=dice[2][3][3]=dice[2][4][4]=dice[2][3][5] = 1;
  dice[3][2][2]=dice[3][4][2]=dice[3][3][3]=dice[3][4][4] = 1;
  dice[4][3][1]=dice[4][2][2]=dice[4][3][3]=dice[4][4][4]=dice[4][3][5] = 1;
  dice[5][3][1]=dice[5][2][2]=dice[5][3][3]=dice[5][2][4]=dice[5][4][4]=dice[5][3][5] = 1;
  dice[6][3][1]=dice[6][4][2]=dice[6][4][4] = 1;
  dice[7][3][1]=dice[7][2][2]=dice[7][4][2]=dice[7][3][3]=dice[7][2][4]=dice[7][4][4]=dice[7][3][5] = 1;
  dice[8][3][1]=dice[8][2][2]=dice[8][4][2]=dice[8][3][3]=dice[8][4][4]=dice[8][3][5] = 1;


  // REP(i, 9) {
  //   REP(y, 7) {
  //     REP(x, 7) {
  //       cout << dice[i][x][y];
  //     }
  //     cout << endl;
  //   }
  //   cout << endl;
  // }
  bool table[21][57];
  char c;
  while(cin>>c,c!='0') {
    REP(i,21) {
      REP(j,57) {
        if (i||j)
          cin >> c;
        if (c=='-'||c=='|') {
          table[i][j] = 1;
        }
        else table[i][j] = 0;
      }
    }
    vector<int> v[2];
    bool table1[21][28];
    REP(i,2) {
      REP(y, 21) {
        REP(x, 28) {
          table1[y][x] = table[y][i*29+x];
        }
      }
      v[i] = hoge(table1);
    }

    int low=0, high=0;
    REP(i, 6) {
      REP(j, 6) {
        if (v[0][i] < v[1][j]) {
          low++;
        } else if (v[0][i] > v[1][j])
          high++;
      }
    }
    if (low>high) {
      cout << "LOW" << endl;
    } else {
      cout << "HIGH" << endl;
    }
  }
}
accuracy: 1
time_ms: 10
memory_kb: 0
final_rank: 1

code_snippet: #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

const string num[9][7] = {
  {
"#######",
"#.....#",
"#...|.#",
"#.....#",
"#...|.#",
"#..-..#",
"#######"
  },
  {
"#######",
"#..-..#",
"#...|.#",
"#..-..#",
"#.|...#",
"#..-..#",
"#######"
  },
  {
"#######",
"#..-..#",
"#...|.#",
"#..-..#",
"#...|.#",
"#..-..#",
"#######"
  },
  {
"#######",
"#.....#",
"#.|.|.#",
"#..-..#",
"#...|.#",
"#.....#",
"#######"
  },
  {
"#######",
"#..-..#",
"#.|...#",
"#..-..#",
"#...|.#",
"#..-..#",
"#######"
  },
  {
"#######",
"#..-..#",
"#.|...#",
"#..-..#",
"#.|.|.#",
"#..-..#",
"#######"
  },
  {
"#######",
"#..-..#",
"#...|.#",
"#.....#",
"#...|.#",
"#.....#",
"#######"
  },
  {
"#######",
"#..-..#",
"#.|.|.#",
"#..-..#",
"#.|.|.#",
"#..-..#",
"#######"
  },
  {
"#######",
"#..-..#",
"#.|.|.#",
"#..-..#",
"#...|.#",
"#..-..#",
"#######"
  }
};

string A[28], B[28];

bool equals(vector<string> &s, const string t[7]) {
  for(int i = 0; i < 7; ++i) {
    for(int j = 0; j < 7; ++j) {
      if((s[i][j] == '-' || s[i][j] == '|') &&
	 (t[i][j] == '-' || t[i][j] == '|')) continue;
      if(s[i][j] != t[i][j]) return false;
    }
  }
  return true;
}

int getNum(vector<string> &s) {
  for(int i = 0; i < 9; ++i) {
    if(equals(s, num[i])) return i+1;
  }
  return 0;
}

void reverseLR(vector<string> &s) {
  for(int i = 0; i < 7; ++i) reverse(s[i].begin(), s[i].end());
}

void reverseTD(vector<string> &s) {
  for(int i = 0; i < 7/2; ++i) {
    for(int j = 0; j < 7; ++j) {
      swap(s[i][j], s[6-i][j]);
    }
  }
}

vector<string> rotate90(vector<string> s) {
  vector<string> t(7, "       ");
  for(int i = 0; i < 7; ++i) {
    for(int j = 0; j < 7; ++j) {
      t[i][j] = s[j][6-i];
    }
  }
  return t;
}

vector<string> rotate270(vector<string> s) {
  vector<string> t(7, "       ");
  for(int i = 0; i < 7; ++i) {
    for(int j = 0; j < 7; ++j) {
      t[i][j] = s[6-j][i];
    }
  }
  return t;
}


vector<string> getFace(int x, int y, string u[28]) {
  vector<string> v;
  for(int i = 0; i < 7; ++i) {
    v.push_back(u[y+i].substr(x,7));
  }
  return v;
}

void show(vector<string> &v) {
  for(int i = 0; i < v.size(); ++i) cout << v[i] << endl;
}

void calcPoint(string u[28], vector<int> &v) {
  vector< vector<string> > face;
  face.push_back(getFace(7,0,u));
  face.push_back(getFace(0,7,u));
  face.push_back(getFace(7,7,u));
  face.push_back(getFace(14,7,u));
  face.push_back(getFace(21,7,u));
  face.push_back(getFace(7,14,u));
  reverseLR(face[0]);
  face[1] = rotate270(face[1]);
  reverseLR(face[1]);
  reverseLR(face[2]);
  face[3] = rotate90(face[3]);
  reverseLR(face[3]);
  reverseLR(face[4]);
  reverseLR(face[5]);
  reverseTD(face[5]);
  int point = 0;
  for(int i = 0; i < 6; ++i) {
    v.push_back(getNum(face[i]));
  }
}

string solve() {
  vector<int> v[2];
  calcPoint(A, v[0]);
  calcPoint(B, v[1]);
  int a, b;
  a = b = 0;
  for(int i = 0; i < v[0].size(); ++i) {
    for(int j = 0; j < v[1].size(); ++j) {
      if(v[0][i] > v[1][j])      ++a;
      else if(v[0][i] < v[1][j]) ++b;
    }
  }
  if(a >= b) return "HIGH";
  else       return "LOW";
}

int main() {
  while(true) {
    string line;
    for(int i = 0; i < 21; ++i) {
      getline(cin, line);
      if(line[0] == '0') return 0;
      A[i] = line.substr(0,28);
      B[i] = line.substr(29);
    }
    cout << solve() << endl;
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 0
final_rank: 1

code_snippet: #include<iostream>
#include<cassert>
#include<algorithm>
#include<vector>
#include<iomanip>
using namespace std;
string digit[9][7]={
  "#######",
  "#.....#",
  "#...|.#",
  "#.....#",
  "#...|.#",
  "#..-..#",
  "#######",
  "#######",
  "#..-..#",
  "#...|.#",
  "#..-..#",
  "#.|...#",
  "#..-..#",
  "#######",
  "#######",
  "#..-..#",
  "#...|.#",
  "#..-..#",
  "#...|.#",
  "#..-..#",
  "#######",
  "#######",
  "#.....#",
  "#.|.|.#",
  "#..-..#",
  "#...|.#",
  "#.....#",
  "#######",
  "#######",
  "#..-..#",
  "#.|...#",
  "#..-..#",
  "#...|.#",
  "#..-..#",
  "#######",
  "#######",
  "#..-..#",
  "#.|...#",
  "#..-..#",
  "#.|.|.#",
  "#..-..#",
  "#######",
  "#######",
  "#..-..#",
  "#...|.#",
  "#.....#",
  "#...|.#",
  "#.....#",
  "#######",
  "#######",
  "#..-..#",
  "#.|.|.#",
  "#..-..#",
  "#.|.|.#",
  "#..-..#",
  "#######",
  "#######",
  "#..-..#",
  "#.|.|.#",
  "#..-..#",
  "#...|.#",
  "#..-..#",
  "#######"
};

vector<string> rotate(vector<string> in){
  int r=in.size(),c=in[0].size();
  vector<string> ret(r,string(c,' '));
  for(int i=0;i<r;i++){
    for(int j=0;j<c;j++){
      ret[i][j]=in[c-j-1][i];
      if (ret[i][j] == '-')ret[i][j]='|';
      else if (ret[i][j] == '|')ret[i][j]='-';
    }
  }
  return ret;
}

vector<string> lrReverse(vector<string> in){
  int r=in.size(),c=in[0].size();
  for(int i=0;i<r;i++){
    for(int j=0;j<c/2;j++){
      swap(in[i][j],in[i][c-1-j]);
    }
  }
  return in;
}

vector<string> udReverse(vector<string> in){
  int r=in.size(),c=in[0].size();
  for(int j=0;j<c;j++){
    for(int i=0;i<r/2;i++){
      swap(in[i][j],in[r-1-i][j]);
    }
  }
  return in;
}

vector<string> getcube(string *in,int y,int x){
  vector<string> ret;
  for(int i=0;i<7;i++){
    string tmp = in[y+i].substr(x,7);
    ret.push_back(tmp);
  }
  return ret;
}

int getdata(vector<string> &in,int pos){
  for(int i=0;i<9;i++){
    vector<string> tmp;
    for(int j=0;j<7;j++)tmp.push_back(digit[i][j]);
    if (pos == 1){
      tmp=rotate(tmp);
    }else if (pos == 3){
      for(int i=0;i<3;i++)tmp=rotate(tmp);
    }else if (pos == 5){
      tmp=udReverse(tmp);
    }
    tmp=lrReverse(tmp);
    if (tmp == in)return i+1;
  }
  assert(false);
}

main(){
  const int py[3]={0,7,14};
  const int px[3][4]={
    {7,-1,-1,-1},
    {0,7,14,21},
    {7,-1,-1,-1}
  };
  const int p[3]={1,4,1};
  string in[21];
  while(cin>>in[0]){
    if (in[0] == "0")break;
    for(int i=1;i<21;i++)cin>>in[i];
    vector<int> d[2];
    for(int l=0;l<2;l++){
      int basex=l*29;
      int cnt=0;
      for(int i=0;i<3;i++){
	for(int j=0;j<p[i];j++){
	  vector<string> tmp = getcube(in,py[i],basex+px[i][j]);
	  d[l].push_back(getdata(tmp,cnt++));
	}
      }
    }
    assert(d[0] != d[1]);
    int high=0,low=0;
    for(int i=0;i<6;i++){
      for(int j=0;j<6;j++){
	if (d[0][i] > d[1][j])high++;
	else if (d[0][i] < d[1][j])low++;
      }
    }
    cout << (high>=low?"HIGH":"LOW") << endl;
  }
  return false;
}
accuracy: 1
time_ms: 30
memory_kb: 912
final_rank: 7