# Arup Guha
# 12/14/2024
# Solution to Kattis Problem: Detailed Differences

# Get # of cases
nC = int(input())

# Process cases.
for loop in range(nC):

    # Read in the two strings.
    s = input().strip()
    t = input().strip()

    # We just print.
    print(s)
    print(t)

    # Go through each letter again.
    for i in range(len(s)):

        # Print appropriately depending on if corresponding items match or not.
        if s[i] == t[i]:
            print('.', end="")
        else:
            print("*", end="")

    # These are their rules.
    print()
    print()
