Problem: A Die Maker

The work of die makers starts early in the morning.

You are a die maker. You receive orders from customers, and make various kinds of dice every day. Today, you received an order of a cubic die with six numbers t1, t2, ..., t6 on whichever faces.

For making the ordered die, you use a tool of flat-board shape. You initially have a die with a zero on each face. If you rotate the die by 90 degrees on the tool towards one of northward, southward, eastward, and southward, the number on the face that newly touches the tool is increased by one. By rotating the die towards appropriate directions repeatedly, you may obtain the ordered die.

The final numbers on the faces of the die is determined by the sequence of directions towards which you rotate the die. We call the string that represents the sequence of directions an operation sequence. Formally, we define operation sequences as follows. An operation sequence consists of n characters, where n is the number of rotations made. If you rotate the die eastward in the i-th rotation, the i-th character of the operation sequence is `E`. Similarly, if you rotate it westward, it is `W`, if southward, it is `S`, otherwise, if northward, it is `N`. For example, the operation sequence `NWS` represents the sequence of three rotations, northward first, westward next, and finally southward.

Given six integers of the customer's order, compute an operation sequence that makes a die to order. If there are two or more possibilities, you should compute the earliest operation sequence in dictionary order.

Input

The input consists of multiple datasets. The number of datasets does not exceed 40. Each dataset has the following form.

> t1 t2 t3 t4 t5 t6
>  p q

t1, t2, ..., t6 are integers that represent the order from the customer. Further, p and q are positive integers that specify the output range of the operation sequence (see the details below).

Each dataset satisfies 0 ≤ t1 ≤ t2 ≤ ... ≤ t6 ≤ 5,000 and 1 ≤ p ≤ q ≤ t1+t2+...+t6. A line containing six zeros denotes the end of the input.

Output

For each dataset, print the subsequence, from the p-th position to the q-th position, inclusively, of the operation sequence that is the earliest in dictionary order. If it is impossible to make the ordered die, print `impossible`.

Here, dictionary order is recursively defined as follows. The empty string comes the first in dictionary order. For two nonempty strings x = x1 ... xk and y = y1 ... yl, the string x precedes the string y in dictionary order if

* x1 precedes y1 in alphabetical order ('A' to 'Z'), or
* x1 and y1 are the same character and x2 ... xk precedes y2 ... yl in dictionary order.



Sample Input


1 1 1 1 1 1
1 6
1 1 1 1 1 1
4 5
0 0 0 0 0 2
1 2
0 0 2 2 2 4
5 9
1 2 3 4 5 6
15 16
0 1 2 3 5 9
13 16
2 13 22 27 31 91
100 170
0 0 0 0 0 0


Output for the Sample Input


EEENEE
NE
impossible
NSSNW
EN
EWNS
SNSNSNSNSNSNSNSNSNSNSNSSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNWEWE






Example

Input

1 1 1 1 1 1
1 6
1 1 1 1 1 1
4 5
0 0 0 0 0 2
1 2
0 0 2 2 2 4
5 9
1 2 3 4 5 6
15 16
0 1 2 3 5 9
13 16
2 13 22 27 31 91
100 170
0 0 0 0 0 0


Output

EEENEE
NE
impossible
NSSNW
EN
EWNS
SNSNSNSNSNSNSNSNSNSNSNSSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNSNWEWE

Solution (in CPP):

Solution:
#pragma gcc optimize("-Ofast,unroll-loops")
#pragma gcc target("avx")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> t(6);
vector<int> optimal(6);
int v[6][4] = {{0, 3, 5, 2}, 
                       {0, 2, 5, 3},
                       {0, 1, 5, 4},
                       {0, 4, 5, 1},
                       {1, 2, 4, 3},
                       {1, 3, 4, 2}};
string b = "EWNS";
struct Dice {
    int s[6];
    int &top() {return s[0];}
    int &south() {return s[1];}
    int &east() {return s[2];}
    int &west() {return s[3];}
    int &north() {return s[4];}
    int &bottom() {return s[5];}
    void roll(char c) {
        for(int k = 0; k < 6; k++) {
            if(b[k] != c) continue;
            int t = s[v[k][0]];
            s[v[k][0]] = s[v[k][1]];
            s[v[k][1]] = s[v[k][2]];
            s[v[k][2]] = s[v[k][3]];
            s[v[k][3]] = t;
            return;
        }
    }
    void print() {
        for(int i = 0; i < 6; i++) cerr << s[i] << " ";
        cerr << endl;
    }
    ll hash() {
        ll res = 0;
        for(int i = 0; i < 6; i++) res = res * 256 + s[i];
        return res;
    }

    bool operator==(const Dice &d) const{
        for(int i = 0; i < 6; i++) if(s[i] != d.s[i]) return 0;
        return 1;
    }
    bool operator!=(const Dice &d) const{
        return !(*this == d);
    }
};
vector<Dice> makeDices(Dice d) {
    vector<Dice> res;
    for(int i = 0; i < 6; i++) {
        Dice t(d);
        if(i == 1) t.roll('N');
        if(i == 2) t.roll('S');
        if(i == 3) t.roll('S'), t.roll('S');
        if(i == 4) t.roll('L');
        if(i == 5) t.roll('R');
        for(int k = 0; k < 4; k++) {
            res.push_back(t);
            t.roll('E');
        }
    }
    return res;
}

bool end() {
    for(int i = 0; i <= 5; i++) {
        if(t[i] != 0) return false;
    }
    return true;
}

bool valid(Dice d) {
    int sum = 0;
    for(int i = 0; i < 6; i++) {
        if(d.s[i] < 0) return false;
        sum += d.s[i];
    }
    if(2 * (d.s[0] + d.s[5]) > sum) return false;
    if(2 * (d.s[2] + d.s[3]) > 1 + sum) return false;
    if(2 * (d.s[1] + d.s[4]) > 1 + sum) return false;
    return true;
}

Dice newDice;
vector<vector<int> > operations;
string direction = "ENSW";
int main() {
    /*
    Dice test;
    for(int i = 0; i < 6; i++) test.s[i] = i + 1;
    test.print();
    test.roll('S');
    test.print();
    test.roll('S');
    test.print();
    test.roll('W');
    test.print();
    */
    Dice zeroDice;
    for(int i = 0; i < 6; i++) zeroDice.s[i] = 0;
    while(true) {
        operations.clear();
        for(int i = 0; i <= 5; i++) cin >> t[i];
        if(end()) break;
        int p, q;
        cin >> p >> q;
        string ans;
        for(int i = 0; i < 6; i++) {
            for(int j = 1; j <= t[i]; j++) ans.push_back('Z');
        }
        sort(t.begin(), t.end());
        do {
            operations.push_back(t);
        } while(next_permutation(t.begin(), t.end()));
        //cerr << operations.size() << endl;
        mt19937 mt;
        shuffle(begin(operations), end(operations), mt);
        for(int INDEX = 0; INDEX < operations.size(); INDEX++) {
            vector<int> t = operations[INDEX];
            bool equals = true;
            //if(t[0] < t[5]) continue;
            Dice initialdice;
            for(int i = 0; i < 6; i++) {
                initialdice.s[i] = t[i];
            }
            vector<Dice> dices = makeDices(initialdice);
            dices.resize(1);
            for(int i = 0; i < dices.size(); i++) {
                Dice nowDice = dices[i];
                //cerr << "--------" << i << "-------" << endl;
                //owDice.print();
                string S = "";
                bool clear = true;
                while(zeroDice != nowDice) {
                    //cerr << "ANSWER: " << ans << endl;
                    //cerr << "now: " << S << endl;
                    //cerr << equals << endl;
                    if(equals) {
                        if(!S.empty()) {
                            int index = S.size() - 1;
                            if(S[i] < ans[i]) {
                                equals = false;
                            } else if(S[i] > ans[i]) {
                                //cerr << "CUT" << endl;
                                clear = false;
                                break;
                            }
                        }
                    }
                    //nowDice.print();
                    bool nowclear = false;
                    for(int i = 0; i < direction.size(); i++) {
                        newDice = nowDice;
                        newDice.roll(direction[i]);
                        newDice.s[5]--;
                        if(valid(newDice)) {
                            nowclear = true;
                            S.push_back(direction[i]);
                            swap(nowDice, newDice);
                            break;
                        }
                        //cerr << "IMPOSSIBLE: " << endl;
                        //newDice.print();
                    }
                    if(!nowclear) {
                        clear = false;
                        break;
                    }
                }
                if(clear) {
                    if(ans > S) {
                        ans = min(S, ans);
                        //optimal = t;
                    }
                }
            }
        }
        if(ans[0] == 'Z') cout << "impossible" << endl;
        else {
            cout << ans.substr(p-1, q - p + 1) << endl;
            //for(int i = 0; i < 6; i++) cerr << optimal[i] << " ";
            //cerr << endl;
        }
    }
    return 0;
}