You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: 1281B.go
    path of file: ./repos/codeforces-go/main/1200-1299
    
    the code of the file until where you have to start completion: package main

import (
	"bufio"
	"bytes"
	. "fmt"
	"io"
)

// github.com/EndlessCheng/codeforces-go
func CF1281B(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var T int
	var s, t []byte
	for Fscan(in
    
func CF1281B(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var T int
	var s, t []byte
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &s, &t)
		last := [26]int{}
		for i := range last {
			last[i] = -1
		}
		for i, b := range s {
			last[b-'A'] = i
		}
		k := byte(0)
		for i, b := range s {
			for k < b-'A' && last[k] < i {
				k++
			}
			if k < b-'A' {
				s[i], s[last[k]] = s[last[k]], s[i]
				break
			}
		}
		if bytes.Compare(s, t) < 0 {
			Fprintf(out, "%s\n", s)
		} else {
			Fprintln(out, "---")
		}
	}
}