```go
package main
import (
"bufio"
"container/heap"
"os"
)
type Item struct {
count int
color int
}
type PriorityQueue []*Item
func (pq PriorityQueue) Len() int { return len(pq) }
func (pq PriorityQueue) Less(i, j int) bool {
return pq[i].count > pq[j].count // Max-heap
}
func (pq PriorityQueue) Swap(i, j int) {
pq[i], pq[j] = pq[j], pq[i]
}
func (pq *PriorityQueue) Push(x interface{}) {
*pq = append(*pq, x.(*Item))
}
func (pq *PriorityQueue) Pop() interface{} {
old := *pq
n := len(old)
item := old[n-1]
old[n-1] = nil
*pq = old[0 : n-1]
return item
}
func writeInt(out *bufio.Writer, n int) {
if n == 0 {
out.WriteByte('0')
return
}
var buf [20]byte
i := 19
for n > 0 {
buf[i] = byte(n%10 + '0')
n /= 10
i--
}
out.Write(buf[i+1:])
}
func writeString(out *bufio.Writer, s string) {
out.WriteString(s)
}
func solve() {
scanner := bufio.NewScanner(os.Stdin)
scanner.Split(bufio.ScanWords)
buf := make([]byte, 1024*1024)
scanner.Buffer(buf, 10*1024*1024)
var nextInt = func() int {
scanner.Scan()
res := 0
for _, b := range scanner.Bytes() {
res = res*10 + int(b-'0')
}
return res
}
if !scanner.Scan() {
return
}
t := 0
for _, b := range scanner.Bytes() {
t = t*10 + int(b-'0')
}
out := bufio.NewWriter(os.Stdout)
defer out.Flush()
for tc := 0; tc < t; tc++ {
n := nextInt()
x := nextInt()
y := nextInt()
b := make([]int, n)
counts := make([]int, n+2)
indices := make([][]int, n+2)
for i := 0; i < n; i++ {
b[i] = nextInt()
counts[b[i]]++
indices[b[i]] = append(indices[b[i]], i)
}
missing := 0
for c := 1; c <= n+1; c++ {
if counts[c] == 0 {
missing = c
break
}
}
pq := make(PriorityQueue, 0, n+1)
for c := 1; c <= n+1; c++ {
if counts[c] > 0 {
pq = append(pq, &Item{count: counts[c], color: c})
}
}
heap.Init(&pq)
ans := make([]int, n)
for i := 0; i < x; i++ {
if pq.Len() == 0 {
break
}
item := heap.Pop(&pq).(*Item)
c := item.color
idx := indices[c][len(indices[c])-1]
indices[c] = indices[c][:len(indices[c])-1]
ans[idx] = c
item.count--
if item.count > 0 {
heap.Push(&pq, item)
}
}
m := n - x
R := make([]int, 0, m)
S := make([]int, 0, m)
for pq.Len() > 0 {
item := heap.Pop(&pq).(*Item)
c := item.color
for _, idx := range indices[c] {
R = append(R, idx)
S = append(S, c)
}
}
shift := m / 2
bad := make([]int, 0, m)
good := make([]int, 0, m)
proposed := make([]int, m)
for k := 0; k < m; k++ {
targetIdx := R[k]
sourceColor := S[(k+shift)%m]
proposed[k] = sourceColor
if sourceColor == b[targetIdx] {
bad = append(bad, k)
} else {
good = append(good, k)
}
}
toReplace := n - y
if len(bad) > toReplace {
writeString(out, "NO\n")
continue
}
for _, k := range bad {
proposed[k] = missing
toReplace--
}
for _, k := range good {
if toReplace > 0 {
proposed[k] = missing
toReplace--
} else {
break
}
}
for k := 0; k < m; k++ {
ans[R[k]] = proposed[k]
}
writeString(out, "YES\n")
for i := 0; i < n; i++ {
if i > 0 {
out.WriteByte(' ')
}
writeInt(out, ans[i])
}
out.WriteByte('\n')
}
}
func main() {
solve()
}
```