#include #define File(a) freopen(a ".in", "r", stdin), freopen(a ".out", "w", stdout) const int N = 200005; int main() { int T; scanf("%d", &T); while (T--) { int n, A, B; scanf("%d %d %d", &n, &A, &B); bool swap = false; static char ch[N]; scanf("%s", ch + 1); std::string str(ch + 1); if (A > B) { std::swap(A, B); for (int i = 0; i < n; ++i) str[i] = ((str[i] - 'a') ^ 1) + 'a'; swap = true; } std::vector a(n + 1), b(n + 1); if (A == 1) { static int dp[N][2]; dp[0][str[0] - 'a'] = 1; dp[0][(str[0] - 'a') ^ 1] = 0; for (int i = 1; i < n; ++i) { if (str[i] == 'b') { dp[i][1] = std::max(dp[i - 1][0], dp[i - 1][1]) + 1; dp[i][0] = dp[i - 1][0]; } else { dp[i][0] = dp[i - 1][0] + 1; dp[i][1] = dp[i - 1][1]; } } int l = std::max(dp[n - 1][0], dp[n - 1][1]); if (B > l) { puts("No"); continue; } int now = -1; for (int i = 0; i < n; ++i) { if (std::max(dp[i][0], dp[i][1]) == B) { now = i + 1; break; } } int cntnow = (n - now) * 2; for (int i = 0; i < now; ++i) { if (str[i] == 'a') b[i] = ++cntnow; } for (int i = now - 1; i >= 0; --i) a[i] = ++cntnow; for (int i = 0; i < now; ++i) { if (str[i] == 'b') b[i] = ++cntnow; } for (int i = now; i < n; ++i) { a[i] = (n - i) * 2, b[i] = (n - i) * 2 - 1; if (str[i] == 'b') std::swap(a[i], b[i]); } } else { int n1 = A - 2, n2 = B - A + 2, n3 = n - B; for (int i = 0; i < n1; ++i) { a[i] = i * 2 + 1, b[i] = i * 2 + 2; if (str[i] == 'a') std::swap(a[i], b[i]); } if (n2) { bool flag = true; for (int i = n1; i < n1 + n2 - 1; ++i) { if (str[i] == 'b' && str[i + 1] == 'a') flag = false; } int pos = n1; if (flag) { a[n1] = n1 * 2 + 1, b[n1] = n1 * 2 + 2; if (str[n1] == 'a') std::swap(a[n1], b[n1]); ++pos; } int nowpos = 2 * pos; for (int i = n1 + n2 - 1; i >= pos; --i) { if (str[i] == 'b') a[i] = ++nowpos; } for (int i = pos; i < n1 + n2; ++i) b[i] = ++nowpos; for (int i = n1 + n2 - 1; i >= pos; --i) { if (str[i] == 'a') a[i] = ++nowpos; } } for (int i = 0; i < n1 + n2; ++i) a[i] += n3 * 2, b[i] += n3 * 2; for (int i = n1 + n2; i < n; ++i) { a[i] = (n - i) * 2, b[i] = (n - i) * 2 - 1; if (str[i] == 'b') std::swap(a[i], b[i]); } } puts("Yes"); if (swap) std::swap(a, b); for (int i = 0; i < n; ++i) printf("%d%c", a[i], " \n"[i == n - 1]); for (int i = 0; i < n; ++i) printf("%d%c", b[i], " \n"[i == n - 1]); } return 0; }