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>
char readCharacter;
bool remaining = false;
template <typename T>
bool readInt(T &x);
template <typename T>
bool readString(T &x);
template <typename T>
bool readChar(T &x);
bool readCharArray(char *&x);
template <typename T>
bool readFloat(T &x);
template <typename T>
bool readDouble(T &x);
bool readVar(bool &x);
bool readVar(short int &x);
bool readVar(int &x);
bool readVar(long int &x);
bool readVar(long long int &x);
bool readVar(unsigned short int &x);
bool readVar(unsigned int &x);
bool readVar(unsigned long &x);
bool readVar(unsigned long long &x);
bool readVar(std::string &x);
bool readVar(char &x);
bool readVar(char *&x);
bool readVar(float &x);
bool readVar(double &x);
bool readVar(long double &x);
template <typename T>
void writeInt(T x);
void writeString(std::string x);
void writeChar(char x);
void writeCharArray(char *x);
void writeFloat(float x);
template <typename T>
void writeDouble(T x);
void writeVar(bool x);
void writeVar(short int x);
void writeVar(int x);
void writeVar(long int x);
void writeVar(long long int x);
void writeVar(unsigned short int x);
void writeVar(unsigned int x);
void writeVar(unsigned long x);
void writeVar(unsigned long long x);
void writeVar(char x);
void writeVar(char *x);
void writeVar(std::string x);
void writeVar(float x);
void writeVar(double x);
void writeVar(long double x);
using namespace std;
int x, l, r, k, u[30], res, t;
string s, a, b;
vector<int> g, e;
int main() {
  readVar(t);
  while (t--) {
    readVar(k), readVar(s), readVar(a), readVar(b);
    int n = int(s.size());
    g.clear();
    for (int i = 0; i < k; ++i) {
      u[i] = -1;
      g.push_back(i);
    }
    bool ok = 0, ok1 = 0, ok2 = 0;
    for (int i = 0; i < n; ++i) {
      x = s[i] - 'a';
      l = a[i] - 'a';
      r = b[i] - 'a';
      res = -1;
      if (ok1) l = -1;
      if (ok2) r = k;
      if (u[x] != -1) {
        if (u[x] < l || u[x] > r) {
          ok = 1;
          break;
        }
        if (u[x] > l) ok1 = 1;
        if (u[x] < r) ok2 = 1;
        continue;
      }
      e.clear();
      for (int j = 0; j < int(g.size()); ++j) {
        if (l > g[j] || r < g[j]) continue;
        e.push_back(j);
        if (int(e.size()) == 3) break;
      }
      if (!int(e.size())) {
        ok = 1;
        break;
      }
      if (int(e.size()) == 1) {
        res = e[0];
      }
      if (res == -1)
        for (auto to : e) {
          if (l < g[to] && g[to] < r) {
            res = to;
            break;
          }
        }
      if (res == -1) {
        if (g[e[0]] == l) res = e[0];
        if (g[e[1]] == l) res = e[1];
        if (res == -1) {
          res = e[0];
        }
      }
      u[x] = g[res];
      if (g[res] > l) ok1 = 1;
      if (g[res] < r) ok2 = 1;
      swap(g[res], g[int(g.size()) - 1]);
      g.pop_back();
    }
    if (!ok) {
      writeVar("YES\n");
      for (int i = 0; i < k; ++i) {
        if (u[i] == -1) {
          u[i] = g[int(g.size()) - 1];
          g.pop_back();
        }
        writeVar(char(u[i] + 'a'));
      }
      writeVar('\n');
      continue;
    }
    g.clear();
    for (int i = 0; i < k; ++i) {
      u[i] = -1;
      g.push_back(i);
    }
    ok = 0;
    ok1 = 0;
    ok2 = 0;
    for (int i = 0; i < n; ++i) {
      x = s[i] - 'a';
      l = a[i] - 'a';
      r = b[i] - 'a';
      res = -1;
      if (ok1) l = -1;
      if (ok2) r = k;
      if (u[x] != -1) {
        if (u[x] < l || u[x] > r) {
          ok = 1;
          break;
        }
        if (u[x] > l) ok1 = 1;
        if (u[x] < r) ok2 = 1;
        continue;
      }
      e.clear();
      for (int j = 0; j < int(g.size()); ++j) {
        if (l > g[j] || r < g[j]) continue;
        e.push_back(j);
        if (int(e.size()) == 3) break;
      }
      if (!int(e.size())) {
        ok = 1;
        break;
      }
      if (int(e.size()) == 1) {
        res = e[0];
      }
      if (res == -1)
        for (auto to : e) {
          if (l < g[to] && g[to] < r) {
            res = to;
            break;
          }
        }
      if (res == -1) {
        if (g[e[0]] == r) res = e[0];
        if (g[e[1]] == r) res = e[1];
        if (res == -1) {
          res = e[0];
        }
      }
      u[x] = g[res];
      if (g[res] > l) ok1 = 1;
      if (g[res] < r) ok2 = 1;
      swap(g[res], g[int(g.size()) - 1]);
      g.pop_back();
    }
    if (!ok) {
      writeVar("YES\n");
      for (int i = 0; i < k; ++i) {
        if (u[i] == -1) {
          u[i] = g[int(g.size()) - 1];
          g.pop_back();
        }
        writeVar(char(u[i] + 'a'));
      }
      writeVar('\n');
      continue;
    }
    writeVar("NO\n");
  }
  return 0;
}
template <typename T>
bool readInt(T &x) {
  x = 0;
  T sig = 1;
  if (!remaining)
    readCharacter = getchar(), remaining = true;
  else
    remaining = false;
  while (!isdigit(readCharacter) && readCharacter != EOF)
    sig = (readCharacter == '-' ? -sig : sig), readCharacter = getchar();
  if (readCharacter == EOF) return remaining = false, false;
  while (isdigit(readCharacter) && readCharacter != EOF)
    x = x * 10 + readCharacter - '0', readCharacter = getchar();
  x *= sig;
  return true;
}
template <typename T>
bool readString(T &x) {
  x = "";
  if (!remaining)
    readCharacter = getchar(), remaining = true;
  else
    remaining = false;
  while (
      (readCharacter == '\n' || readCharacter == '\t' || readCharacter == ' '))
    readCharacter = getchar();
  if (readCharacter == EOF) return remaining = false, false;
  while ((readCharacter != '\n' && readCharacter != '\t' &&
          readCharacter != ' ' && readCharacter != EOF))
    x += readCharacter, readCharacter = getchar();
  return true;
}
template <typename T>
bool readChar(T &x) {
  if (!remaining)
    readCharacter = getchar();
  else
    remaining = false;
  if (readCharacter == EOF) return remaining = false, false;
  while (
      (readCharacter == '\n' || readCharacter == '\t' || readCharacter == ' '))
    readCharacter = getchar();
  remaining = false;
  x = readCharacter;
  return true;
}
bool readCharArray(char *&x) {
  std::string y;
  if (readString(y) == false) return false;
  x = new char[(int)y.size() + 1];
  strcpy(x, y.c_str());
  return true;
}
template <typename T>
bool readFloat(T &x) {
  return (scanf("%f", &x) != EOF);
}
template <typename T>
bool readDouble(T &x) {
  double y;
  if (scanf("%lf", &y) == EOF) return false;
  x = y;
  return true;
}
bool readVar(bool &x) {
  int aux;
  bool ret = readInt(aux);
  x = (aux != 0);
  return ret;
}
bool readVar(short int &x) { return readInt(x); }
bool readVar(int &x) { return readInt(x); }
bool readVar(long int &x) { return readInt(x); }
bool readVar(long long int &x) { return readInt(x); }
bool readVar(unsigned short int &x) { return readInt(x); }
bool readVar(unsigned int &x) { return readInt(x); }
bool readVar(unsigned long &x) { return readInt(x); }
bool readVar(unsigned long long &x) { return readInt(x); }
bool readVar(std::string &x) { return readString(x); }
bool readVar(char &x) { return readChar(x); }
bool readVar(char *&x) { return readCharArray(x); }
bool readVar(float &x) { return readFloat(x); }
bool readVar(double &x) { return readDouble(x); }
bool readVar(long double &x) { return readDouble(x); }
template <typename T>
void writeInt(T x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  char writeBuffer[20], *writePtr = writeBuffer;
  do {
    *writePtr++ = '0' + x % 10;
    x /= 10;
  } while (x);
  do {
    putchar(*--writePtr);
  } while (writePtr > writeBuffer);
}
void writeChar(char x) { putchar(x); }
void writeCharArray(char *x) {
  while (*x != '\0') putchar(*x++);
}
void writeString(std::string x) {
  for (char c : x) putchar(c);
}
void writeFloat(float x) { printf("%f", x); }
template <typename T>
void writeDouble(T x) {
  printf("%lf", (double)x);
}
void writeVar(bool x) { writeInt(x); }
void writeVar(short int x) { writeInt(x); }
void writeVar(int x) { writeInt(x); }
void writeVar(long int x) { writeInt(x); }
void writeVar(long long int x) { writeInt(x); }
void writeVar(unsigned short int x) { writeInt(x); }
void writeVar(unsigned int x) { writeInt(x); }
void writeVar(unsigned long x) { writeInt(x); }
void writeVar(unsigned long long x) { writeInt(x); }
void writeVar(std::string x) { writeString(x); }
void writeVar(char x) { writeChar(x); }
void writeVar(char *x) { writeCharArray(x); }
void writeVar(float x) { writeFloat(x); }
void writeVar(double x) { writeDouble(x); }
void writeVar(long double x) { writeDouble(x); }
