------
## 最终结论
```python
def swap_to_lexicographically_smaller(s, c):
    n = len(s)
    s_list = list(s)
    
    # Check if the original string is already smaller
    if s < c:
        return s
    
    for i in range(n):
        for j in range(i + 1, n):
            # Swap characters at indices i and j
            s_list[i], s_list[j] = s_list[j], s_list[i]
            new_s = ''.join(s_list)
            
            # Check if the new string is strictly smaller than c
            if new_s < c:
                return new_s
            
            # Swap back to original positions
            s_list[i], s_list[j] = s_list[j], s_list[i]
    
    return "---"

def process_test_cases(test_cases):
    results = []
    for s, c in test_cases:
        result = swap_to_lexicographically_smaller(s, c)
        results.append(result)
    return results

# Read input
t = int(input().strip())
test_cases = [tuple(input().strip().split()) for _ in range(t)]

# Process each test case and print results
results = process_test_cases(test_cases)
for result in results:
    print(result)
```