Problem: I came to the summer festival with the elementary school students in my neighborhood. To put it bluntly, it plays the role of a guardian, but the smell of yakisoba and takoyaki in the store, and the sound of fireworks that can be heard from time to time, are still exciting even at this age. But today I have to keep an eye on the curious children so they don't get lost.

The children seemed to be interested in opening a store. When I looked into it, I was supposed to play a game using dice with the uncle who opened the store, and if I win, I would get a prize. The game is a simple one called High & Low. Participants and uncles roll one dice each, but before that, participants predict whether their rolls will be greater or lesser than their uncle's rolls. If the prediction is correct, it is a victory, and if the same result is rolled, both roll the dice again.

The tricky part of this game is that the dice of the participants and the dice of the uncle may be different. Participants can see the development of both dice in advance, so they can expect it as a hint.

In other words, it's a simple probability calculation. However, the probability is in the range of high school mathematics, and it may be a little heavy for elementary school students. Even the most clever of the kids are thinking, shaking their braided hair. I'll be asking for help soon. By the way, let's show you something that seems to be an adult once in a while.



Input

The input consists of multiple cases.


In each case, a development of the dice is given in a 21x57 grid.
The first 21x28 ((0,0) is the upper left, (20,27) is the lower right) grid represents the participants' dice.
The last 21x28 ((0,29) is the upper left, (20,56) is the lower right) represents the uncle's dice.


Each side of the participant's dice is 7x7 with (0,7), (7,0), (7,7), (7,14), (7,21), (14,7) as the upper left. Given in the subgrid of.
The numbers written on the development drawing are the original numbers.
Flip horizontal
Flip left and right, then rotate 90 degrees counterclockwise
Flip horizontal
Flip left and right, then rotate 270 degrees counterclockwise
Flip horizontal
Flip upside down, then flip left and right
It was made to do.


Each side of the uncle's dice is 7x7 with (0,36), (7,29), (7,36), (7,43), (7,50), (14,36) as the upper left. Given in the subgrid.
The numbers on the uncle's dice development are drawn according to the same rules as the participants' dice.



One of 1 to 9 is written on each side of the dice.
The numbers are given in a 7x7 grid like this:

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



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



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



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



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



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



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



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



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




However, when the above numbers are rotated 90 degrees or 270 degrees, the "|" and "-" are interchanged.


The end of the input is given by a single 0 line

The dice given as input are always correct. Also, dice that cannot be settled are not given.

Output

Output the one with the higher probability in one line when it becomes "HIGH" and when it becomes "LOW". If both probabilities are the same, output "HIGH".

Examples

Input

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


Output

LOW
HIGH
HIGH
LOW


Input

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


Output

LOW
HIGH
HIGH
LOW

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

const ll n=9;
const ll m=7;

string S[9]={
R"(#######
#.....#
#...|.#
#.....#
#...|.#
#..-..#
#######
)",
R"(#######
#..-..#
#...|.#
#..-..#
#.|...#
#..-..#
#######
)",
R"(#######
#..-..#
#...|.#
#..-..#
#...|.#
#..-..#
#######
)",
R"(#######
#.....#
#.|.|.#
#..-..#
#...|.#
#.....#
#######
)",
R"(#######
#..-..#
#.|...#
#..-..#
#...|.#
#..-..#
#######
)",
R"(#######
#..-..#
#.|...#
#..-..#
#.|.|.#
#..-..#
#######
)",
R"(#######
#..-..#
#...|.#
#.....#
#...|.#
#.....#
#######
)",
R"(#######
#..-..#
#.|.|.#
#..-..#
#.|.|.#
#..-..#
#######
)",
R"(#######
#..-..#
#.|.|.#
#..-..#
#...|.#
#..-..#
#######
)",
};

vector<string> invlr(vector<string> a){
  vector<string> res(m);
  rep(i,m)rep(j,m)res[i]+=a[i][m-1-j];

  return res;
}

vector<string> invud(vector<string> a){
  vector<string> res(m);
  rep(i,m)rep(j,m)res[m-1-i]+=a[i][j];

  return res;
}

vector<string> rot90(vector<string> a){
  vector<string> res(m);
  rep(i,m)rep(j,m)res[i]+=a[i][j];
  rep(i,m)rep(j,m){
    if(a[i][j]=='|')res[m-1-j][i]='-';
    else if(a[i][j]=='-')res[m-1-j][i]='|';
    else res[m-1-j][i]=a[i][j];
  }

  return res;
}

bool issame(const vector<string>& a, const vector<string>& b){
  rep(i,m)rep(j,m)if(a[i]!=b[i])return false;
  return true;
}

vector<ll> getnum(const vector<vector<string>>& bs, const vector<string>& a){
  vector<ll> si={0,7,7,7,7,14};
  vector<ll> sj={7,0,7,14,21,7};

  vector<ll> res;
  rep(h,6){
    vector<string> ext;
    rep(i,m){
      string tmp;
      rep(j,m){
        tmp+=a[si[h]+i][sj[h]+j];
      }
      ext.push_back(tmp);
    }


    if(h%2==0){
      ext=invlr(ext);
    }else if(h==1){
      ext=rot90(ext);
      ext=rot90(ext);
      ext=rot90(ext);
      ext=invlr(ext);
    }else if(h==3){
      ext=rot90(ext);
      ext=invlr(ext);
    }else{
      ext=invlr(ext);
      ext=invud(ext);
    }

    rep(num,n){
      if(issame(ext,bs[num])){
        res.push_back(num+1);
        break;
      }
    }
  }
  return res;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  vector<vector<string>> bs;
  bs.resize(n);
  rep(i,n){
    string crt=S[i];
    ll idx=0;
    rep(j,7){
      string tmp;
      while(idx<crt.size()&&crt[idx]!='\n'){
        tmp+=crt[idx];
        idx++;
      }
      idx++;
      bs[i].push_back(tmp);
    }
  }

  while(1){
    string input;
    cin>>input;
    if(input=="0")break;
    vector<string> A,B;
    A.push_back(input.substr(0,28));
    B.push_back(input.substr(29,28));
    rep(h,20){
      cin>>input;
      A.push_back(input.substr(0,28));
      B.push_back(input.substr(29,28));
    }
    vector<ll> Anum=getnum(bs,A);
    vector<ll> Bnum=getnum(bs,B);

    ll cnta=0,cntb=0;
    rep(i,6)rep(j,6){
      if(Anum[i]>Bnum[j])cnta++;
      if(Anum[i]<Bnum[j])cntb++;
    }
    if(cnta>=cntb)cout<<"HIGH"<<endl;
    else cout<<"LOW"<<endl;
  }

  return 0;
}