T = int(input())
for _ in range(T):
    s = list(input())
    t = list(input())

    p1 = 0  # s的指针
    p2 = 0  # t的指针

    while p1 < len(s) and p2 < len(t):
        if s[p1] == '?':
            s[p1] = t[p2]  # 把?变成 t[p2]
            p1 += 1
            p2 += 1
        elif s[p1] == t[p2]:
            p1 += 1
            p2 += 1
        else:
            p1 += 1  # 跳过不匹配的字符

    # 将剩下的?全部替换为a
    s = ''.join(s).replace('?', 'a')

    if p2 == len(t):
        print('YES')
        print(s)
    else:
        print('NO')