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;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

vector<vector<string>> dice = {{
                                   "#######",
                                   "#.....#",
                                   "#...|.#",
                                   "#.....#",
                                   "#...|.#",
                                   "#..-..#",
                                   "#######",
                               },
                               {
                                   "#######",
                                   "#..-..#",
                                   "#...|.#",
                                   "#..-..#",
                                   "#.|...#",
                                   "#..-..#",
                                   "#######",
                               },
                               {
                                   "#######",
                                   "#..-..#",
                                   "#...|.#",
                                   "#..-..#",
                                   "#...|.#",
                                   "#..-..#",
                                   "#######",
                               },
                               {
                                   "#######",
                                   "#.....#",
                                   "#.|.|.#",
                                   "#..-..#",
                                   "#...|.#",
                                   "#.....#",
                                   "#######",
                               },
                               {
                                   "#######",
                                   "#..-..#",
                                   "#.|...#",
                                   "#..-..#",
                                   "#...|.#",
                                   "#..-..#",
                                   "#######",
                               },
                               {
                                   "#######",
                                   "#..-..#",
                                   "#.|...#",
                                   "#..-..#",
                                   "#.|.|.#",
                                   "#..-..#",
                                   "#######",
                               },
                               {
                                   "#######",
                                   "#..-..#",
                                   "#...|.#",
                                   "#.....#",
                                   "#...|.#",
                                   "#.....#",
                                   "#######",
                               },
                               {
                                   "#######",
                                   "#..-..#",
                                   "#.|.|.#",
                                   "#..-..#",
                                   "#.|.|.#",
                                   "#..-..#",
                                   "#######",
                               },
                               {
                                   "#######",
                                   "#..-..#",
                                   "#.|.|.#",
                                   "#..-..#",
                                   "#...|.#",
                                   "#..-..#",
                                   "#######",
                               }

};

// デバッグ出力
void printDebug(vector<string> &g) {
    for(int i = 0; i < g.size(); i++) {
        cout << g[i] << endl;
    }
}

// 上下反転
void updown(vector<string> &g) { reverse(ALL(g)); };
// 左右反転
void leftright(vector<string> &g) {
    for(int i = 0; i < g.size(); i++) {
        reverse(ALL(g[i]));
    }
};
// 反時計回りに90度回転したものを元に戻す
// つまり時計回りに90度回転
void Turn90(vector<string> &g) {
    vector<string> res;
    for(int x = 0; x < g[0].size(); x++) {
        string tmp = "";
        for(int y = g.size() - 1; y >= 0; y--) {
            tmp += g[y][x];
        }
        res.emplace_back(tmp);
    }
    g = res;
    for(int i = 0; i < g.size(); i++) {
        for(int j = 0; j < g[i].size(); j++) {
            if(g[i][j] == '|') {
                g[i][j] = '-';
            } else if(g[i][j] == '-') {
                g[i][j] = '|';
            }
        }
    }
};
// 反時計回りに270度回転したものを元に戻す
// つまり反時計回りに90度回転
void Turn270(vector<string> &g) {
    vector<string> res;
    for(int x = g[0].size() - 1; x >= 0; x--) {
        string tmp = "";
        for(int y = 0; y < g.size(); y++) {
            tmp += g[y][x];
        }
        res.emplace_back(tmp);
    }
    g = res;
    for(int i = 0; i < g.size(); i++) {
        for(int j = 0; j < g[i].size(); j++) {
            if(g[i][j] == '|') {
                g[i][j] = '-';
            } else if(g[i][j] == '-') {
                g[i][j] = '|';
            }
        }
    }
};

// (sy, sx)を左上とする面を取得して返す
vector<string> getDice(int sy, int sx, vector<string> &s) {
    vector<string> res;
    for(int i = sy; i < sy + 7; i++) {
        string tmp = "";
        for(int j = sx; j < sx + 7; j++) {
            tmp += s[i][j];
        }
        res.emplace_back(tmp);
    }
    return res;
}

// 面の数字を計算して返す
int calc(vector<string> &g) {
    for(int i = 0; i < dice.size(); i++) {
        if(dice[i] == g) {
            return i + 1;
        }
    }
    return 0;
}

bool solve() {
    vector<string> s(21);
    vector<int> left, right;
    for(int i = 0; i < 21; i++) {
        cin >> s[i];
        if(s[i] == "0") {
            return false;
        }
    }
    vector<string> m[6];
    m[0] = getDice(0, 7, s);
    leftright(m[0]);
    m[1] = getDice(7, 0, s);
    Turn90(m[1]);
    leftright(m[1]);
    m[2] = getDice(7, 7, s);
    leftright(m[2]);
    m[3] = getDice(7, 14, s);
    Turn270(m[3]);
    leftright(m[3]);
    m[4] = getDice(7, 21, s);
    leftright(m[4]);
    m[5] = getDice(14, 7, s);
    leftright(m[5]);
    updown(m[5]);
    for(int i = 0; i < 6; i++) {
        left.emplace_back(calc(m[i]));
        m[i].clear();
    }
    m[0] = getDice(0, 36, s);
    leftright(m[0]);
    m[1] = getDice(7, 29, s);
    Turn90(m[1]);
    leftright(m[1]);
    m[2] = getDice(7, 36, s);
    leftright(m[2]);
    m[3] = getDice(7, 43, s);
    Turn270(m[3]);
    leftright(m[3]);
    m[4] = getDice(7, 50, s);
    leftright(m[4]);
    m[5] = getDice(14, 36, s);
    leftright(m[5]);
    updown(m[5]);
    for(int i = 0; i < 6; i++) {
        right.emplace_back(calc(m[i]));
    }
    int high = 0, low = 0;
    for(int i = 0; i < 6; i++) {
        for(int j = 0; j < 6; j++) {
            if(left[i] > right[j]) {
                high++;
            } else if(left[i] < right[j]) {
                low++;
            }
        }
    }
    cout << (high >= low ? "HIGH" : "LOW") << endl;
    return true;
}

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