**Problem link: **https://www.codechef.com/problems/LUCKY10

**Problem in short: **

You are given two strings **A** and **B** consisting of digits 0 to 9 and of length **n**. You create a string **C** from **A** and **B** as follows:

- Re-order the strings
**A**and**B**in any way you want. - i-th digit of
**C**is given by**C[i] = max{A[i], B[i]}**. - Remove all digits from
**C**that are not 4 or 7.

You want to find the string **C** which is the *lexicographically* greatest possible string among all the strings that can be obtained from the given strings **A **and **B **by the described process.

**Constraints:**

- n <= 20,000
- Number of test cases T <= 10,000
- Sum of n over all test cases <= 200,000