Taro and Hanako, students majoring in biology, have been engaged long in observations of beehives. Their interest is in finding any egg patterns laid by queen bees of a specific wild species. A queen bee is said to lay a batch ofeggs in a short time. Taro and Hanako have never seen queen bees laying eggs. Thus, every time they find beehives, they find eggs just laid in hive cells.

Taro and Hanako have a convention to record an egg layout.. they assume the queen bee lays eggs, moving from one cell to an adjacent cell along a path containing no cycles. They record the path of cells with eggs. There is no guarantee in biology for them to find an acyclic path in every case. Yet they have never failed to do so in their observations.

<image>

There are only six possible movements from a cell to an adjacent one, and they agree to write down those six by letters a, b, c, d, e, and f ounterclockwise as shown in Figure 2. Thus the layout in Figure 1 may be written down as "faafd".

Taro and Hanako have investigated beehives in a forest independently. Each has his/her own way to approach beehives, protecting oneself from possible bee attacks.

They are asked to report on their work jointly at a conference, and share their own observation records to draft a joint report. At this point they find a serious fault in their convention. They have never discussed which direction, in an absolute sense, should be taken as "a", and thus Figure 2 might be taken as, e.g., Figure 3 or Figure 4. The layout shown in Figure 1 may be recorded differently, depending on the direction looking at the beehive and the path assumed: "bcbdb" with combination of Figure 3 and Figure 5, or "bccac" with combination of Figure 4 and Figure 6.

A beehive can be observed only from its front side and never from its back, so a layout cannot be confused with its mirror image.

Since they may have observed the same layout independently, they have to find duplicated records in their observations (Of course, they do not record the exact place and the exact time of each observation). Your mission is to help Taro and Hanako by writing a program that checks whether two observation records are made from the same layout.

<image>



Input

The input starts with a line containing the number of record pairs that follow. The number is given with at most three digits.

Each record pair consists of two lines of layout records and a line containing a hyphen. Each layout record consists of a sequence of letters a, b, c, d, e, and f. Note that a layout record may be an empty sequence if a queen bee laid only one egg by some reason. You can trust Taro and Hanako in that any of the paths in the input does not force you to visit any cell more than once. Any of lines in the input contain no characters other than those described above, and contain at most one hundred characters.

Output

For each pair of records, produce a line containing either "true" or "false": "true" if the two records represent the same layout, and "false" otherwise. A line should not contain any other characters.

Example

Input

5
faafd
bcbdb
-
bcbdb
bccac
-
faafd
aafdd
-
aaafddd
aaaeff
-
aaedd
aafdd
-


Output

true
true
false
false
false
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for ( int i = 0; i < (int)n; i++ )
#define MAX 250

bool compute(string str1, string str2){
  bool V1[MAX][MAX], V2[MAX][MAX];
  int ldy1, ldx1, rty1, rtx1;
  int dy[6] = {1, 1, 0, -1, -1, 0};
  int dx[6] = {0, -1, -1, 0, 1, 1};
  if ( str1.size() != str2.size() ) return false;
  int n = (int)str1.size()*2+2;
  rep(y, n) rep(x, n) V1[y][x] = false;

  int py = n/2;
  int px = n/2;
  V1[py][px] = true;
  ldy1 = rty1 = py;
  ldx1 = rtx1 = px;
  rep(i, str1.size()){
    int r = (str1[i]-'a')%6;
    py += dy[r];
    px += dx[r];
    V1[py][px] = true;
    ldy1 = min(ldy1, py);
    ldx1 = min(ldx1, px);
    rty1 = max(rty1, py);
    rtx1 = max(rtx1, px);
  }

  rep(d, 6){
    int ldy2, ldx2, rty2, rtx2;
    py = n/2;
    px = n/2;
    ldy2 = rty2 = py;
    ldx2 = rtx2 = px;
    rep(y, n) rep(x, n) V2[y][x] = false;
    V2[py][px] = true;
    rep(i, str2.size()){
      int r = (str2[i]-'a'+d)%6;
      py += dy[r];
      px += dx[r];
      V2[py][px] = true;
      ldy2 = min(ldy2, py);
      ldx2 = min(ldx2, px);
      rty2 = max(rty2, py);
      rtx2 = max(rtx2, px);
    }
    if ( !(rty1-ldy1 == rty2-ldy2 && rtx1-ldx1 == rtx2-ldx2 ) ) continue;
    int h = rty1-ldy1+1;
    int w = rtx1-ldx1+1;
    bool same = true;
    rep(y, h) rep(x, w){
      if ( V1[y+ldy1][x+ldx1] != V2[y+ldy2][x+ldx2] ) {same = false; break;}
    }
    if ( same ) return true;
  }
  return false;
}

int main(){
  int tcase; cin >> tcase;
  string str1, str2, kasu;
  getline(cin, kasu);
  rep(t, tcase) {
    getline(cin, str1);
    getline(cin, str2);
    if (compute(str1, str2) ) cout << "true" << endl;
    else cout << "false" << endl;
    getline(cin, kasu);
  }
}