Vasya owns three strings s , a and b, each of them consists only of first k Latin letters.

Let a template be such a string of length k that each of the first k Latin letters appears in it exactly once (thus there are k! distinct templates). Application of template p to the string s is the replacement of each character in string s with p_i, i is the index of this letter in the alphabet. For example, applying template "bdca" to a string "aabccd" yields string "bbdcca".

Vasya wants to know if there exists such a template which yields a string lexicographically greater than or equal to string a and lexicographically less than or equal to string b after applying it to s.

If there exist multiple suitable templates, print any of them.

String a is lexicographically less than string b if there is some i (1 ≤ i ≤ n) that a_i < b_i and for any j (1 ≤ j < i) a_j = b_j.

You are required to answer t testcases independently.

Input

The first line contains a single integer t (1 ≤ t ≤ 10^6) — the number of testcases.

In hacks you can only use t = 1.

Each of the next t lines contains the description of the testcase in the following form:

The first line of the testcase contains a single integer k (1 ≤ k ≤ 26) — the length of the template.

The second line of the testcase contains the string s (1 ≤ |s| ≤ 10^6).

The third line of the testcase contains the string a.

The fourth line of the testcase contains the string b.

Strings s, a and b have the same length (|s| = |a| = |b|) and consist only of the first k Latin letters, all letters are lowercase.

It is guaranteed that string a is lexicographically less than or equal to string b.

It is also guaranteed that the total length of strings over all testcase won't exceed 3 ⋅ 10^6.

Output

Print the answers to all testcases in the following form:

If there exists no suitable template then print "NO" in the first line.

Otherwise print "YES" in the first line and the template itself in the second line (k lowercase letters, each of the first k Latin letters should appear exactly once).

If there exist multiple suitable templates, print any of them.

Example

Input

2
4
bbcb
aada
aada
3
abc
bbb
bbb


Output

YES
badc
NO
#include <bits/stdc++.h>
using namespace std;
template <typename T>
void maxtt(T& t1, T t2) {
  t1 = max(t1, t2);
}
template <typename T>
void mintt(T& t1, T t2) {
  t1 = min(t1, t2);
}
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "URDL";
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int& x, int y, int mod = 998244353) {
  assert(y >= 0);
  x += y;
  if (x >= mod) x -= mod;
  assert(x >= 0 && x < mod);
}
void et(int x = -1) {
  printf("%d\n", x);
  exit(0);
}
long long fastPow(long long x, long long y, int mod = 998244353) {
  long long ans = 1;
  while (y > 0) {
    if (y & 1) ans = (x * ans) % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
long long gcd1(long long x, long long y) { return y ? gcd1(y, x % y) : x; }
char s[1000035], a[1000035], b[1000035];
int p[33], rp[33];
bool calS(int pos) {
  vector<int> tp(30, -1), trp(30, -1);
  for (int(i) = 0; (i) < (int)(k); (i)++) {
    tp[i] = p[i];
    trp[i] = rp[i];
  }
  for (int i = pos; i <= n; i++) {
    int c = s[i] - 'a', t = a[i] - 'a';
    if (tp[c] == -1) {
      for (int j = k - 1; j >= t; j--)
        if (trp[j] == -1) {
          trp[j] = c;
          tp[c] = j;
          break;
        }
      if (tp[c] == -1) return 0;
    }
    assert(tp[c] != -1);
    if (tp[c] < t) return 0;
    if (tp[c] > t) {
      for (int(i) = 0; (i) < (int)(k); (i)++) {
        p[i] = tp[i];
        rp[i] = trp[i];
      }
      return 1;
    }
  }
  for (int(i) = 0; (i) < (int)(k); (i)++) {
    p[i] = tp[i];
    rp[i] = trp[i];
  }
  return 1;
}
bool calB(int pos) {
  vector<int> tp(30, -1), trp(30, -1);
  for (int(i) = 0; (i) < (int)(k); (i)++) {
    tp[i] = p[i];
    trp[i] = rp[i];
  }
  for (int i = pos; i <= n; i++) {
    int c = s[i] - 'a', t = b[i] - 'a';
    if (tp[c] == -1) {
      for (int j = 0; j <= t; j++)
        if (trp[j] == -1) {
          trp[j] = c;
          tp[c] = j;
          break;
        }
      if (tp[c] == -1) return 0;
    }
    assert(tp[c] != -1);
    if (tp[c] > t) return 0;
    if (tp[c] < t) {
      for (int(i) = 0; (i) < (int)(k); (i)++) {
        p[i] = tp[i];
        rp[i] = trp[i];
      }
      return 1;
    }
  }
  for (int(i) = 0; (i) < (int)(k); (i)++) {
    p[i] = tp[i];
    rp[i] = trp[i];
  }
  return 1;
}
void fmain(int tid) {
  scanf("%d", &k);
  for (int(i) = 0; (i) < (int)(k); (i)++) {
    p[i] = -1;
    rp[i] = -1;
  }
  scanf("%s%s%s", s + 1, a + 1, b + 1);
  n = strlen(s + 1);
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    int c = s[i] - 'a', A = a[i] - 'a', B = b[i] - 'a';
    if (A == B) {
      if (p[c] != -1 && p[c] != A) {
        if (!debug) puts("NO");
        return;
      }
      if (rp[A] != -1 && rp[A] != c) {
        if (!debug) puts("NO");
        return;
      }
      p[c] = A;
      rp[A] = c;
    } else {
      if (p[c] != -1) {
        if (p[c] < A || p[c] > B) {
          if (!debug) puts("NO");
          return;
        }
        if (p[c] > A && p[c] < B) break;
        if (p[c] == A) {
          if (calS(i + 1))
            break;
          else {
            if (!debug) puts("NO");
            return;
          }
        } else {
          assert(p[c] == B);
          if (calB(i + 1))
            break;
          else {
            if (!debug) puts("NO");
            return;
          }
        }
      } else {
        bool ok = 0;
        for (int z = A + 1; z < B; z++)
          if (rp[z] == -1) {
            p[c] = z;
            rp[z] = c;
            ok = 1;
            break;
          }
        if (ok) break;
        if (rp[A] == -1) {
          p[c] = A;
          rp[A] = c;
          if (calS(i + 1)) break;
          p[c] = -1;
          rp[A] = -1;
        }
        if (rp[B] == -1) {
          p[c] = B;
          rp[B] = c;
          if (calB(i + 1)) break;
          p[c] = -1;
          rp[B] = -1;
        }
        if (!debug) puts("NO");
        return;
      }
    }
  }
  if (!debug) puts("YES");
  vector<int> rm;
  for (int(j) = 0; (j) < (int)(k); (j)++)
    if (rp[j] == -1) rm.push_back(j);
  for (int(j) = 0; (j) < (int)(k); (j)++)
    if (p[j] == -1) {
      assert(!rm.empty());
      p[j] = rm.back();
      rm.pop_back();
    }
  for (int(j) = 0; (j) < (int)(k); (j)++)
    if (!debug) printf("%c", 'a' + p[j]);
  if (!debug) puts("");
}
int main() {
  int t = 1;
  scanf("%d", &t);
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain(i);
  }
  return 0;
}
