Vivek was quite bored with the lockdown, so he came up with an interesting task. He successfully completed this task and now, he would like you to solve it.
You are given two strings $A$ and $B$, each with length $N$. Let's index the characters in each string from $0$ ― for each $i$ ($0 \le i < N$), the $i+1$-th characters of $A$ and $B$ are denoted by $A_i$ and $B_i$ respectively. You should convert $A$ to $B$ by performing operations of the following type:
- Choose a subset $S$ of the set $\{0, 1, \ldots, N-1\}$.
- Let $c$ be the alphabetically smallest character among $A_x$ for all $x \in S$.
- For each $x \in S$, replace $A_x$ by $c$.
You should find the smallest necessary number of operations or report that it is impossible to convert $A$ to $B$. If it is possible, you also need to find one way to convert $A$ to $B$ using this smallest number of operations. If there are multiple solutions, you may find any one.

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first line of each test case contains a single integer $N$.
- The second line contains a single string $A$.
- The third line contains a single string $B$.

-----Output-----
For each test case:
- If it is impossible to convert $A$ to $B$, print a single line containing the integer $-1$.
- Otherwise, first, print a line containing a single integer $K$ ― the minimum number of operations.
- Then, print $K$ lines describing the operations. Each of these lines should contain a positive integer $Z$, followed by a space and $Z$ pairwise distinct space-separated integers from the set $\{0, 1, \ldots, N-1\}$ ― the elements of $S$.

-----Constraints-----
- $1 \le T \le 20$
- $1 \le N \le 10^3$
- $|A| = |B| = N$
- $A$ and $B$ contain only lowercase English letters

-----Subtasks-----
Subtask #1 (30 points): $B$ contains only characters 'a' and 'b'
Subtask #2 (70 points): original constraints

-----Example Input-----
3
5
abcab
aabab
3
aaa
aab
2
de
cd

-----Example Output-----
2
3 1 2 4
3 0 1 3
-1
-1

-----Explanation-----
Example case 1:
- First, we can choose $S = (1, 2, 4)$, so the character $c$ is 'b' and the string $A$ after this operation is "abbab".
- Then, we choose $S = (0, 1, 3)$, so $c$ is 'a', and $A$ becomes "aabab".
- There is no way to convert $A$ to $B$ in only one operation.
Example case 2: We can see that it is impossible to convert $A$ to $B$ since $c$ is always 'a'.
Example case 3: We can see again that it is impossible to convert $A$ to $B$ since $c$ cannot be 'c'.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = '\'\'\'for _ in range(int(input())):\n    N = int(input())\n    a = list(input())\n    b = list(input())\n    aset = set(a)\n    bset = set(b)\n    if(a == b):\n     print(0)\n\n    elif(bset.issubset(aset)):\n     d = {}\n     wr = {}\n     f = 0\n     for i in range(N):\n      if(a[i] != b[i]):\n       if b[i] in d:\n        d[b[i]].append(i)\n        wr[b[i]].append(a[i])\n       else:\n        d[b[i]] = []\n        wr[b[i]] = []\n        d[b[i]].append(i)\n        wr[b[i]].append(a[i])\n     #print(wr,d)\n\n     for k,v in sorted(wr.items(),reverse=True):\n      # print(k,v)\n      for i in v:\n       # print(k,i)\n       if ord(k)>ord(i):\n        f=1\n        break\n      if f==1:\n       break\n     # print(flag)\n     if f==1:\n      print(-1)\n     else:\n      print(len(d))\n      for k,v in sorted(d.items(),reverse=True):\n       print(len(d[k])+1,end=" ")\n       print(d[k],a.index(k))\n\n\n\n    else:\n     print(-1)\'\'\' \n\n\nfor _ in range(int(input())):\n n=int(input())\n \n a=list(input())\n \n b=list(input())\n if(a==b):\n  print(0)\n else:\n  l=[]\n  c=0\n  for i in range(n):\n   if(b[i] not in l):\n    if(b[i] not in a):\n     c=1\n     break\n    l.append(b[i])\n  if(c):\n   print(-1)\n  else:\n   l.sort()\n   l.reverse()\n   truthy=0\n   list1=[]\n   for i in range(len(l)):\n    current=l[i]\n    posb=[]\n    one=None\n    for j in range(n):\n     if(one==None):\n      if(a[j]==current):\n       one=j\n     if(b[j]==current):\n      posb.append(j)\n    for j in range(len(posb)):\n     if(a[posb[j]]<current):\n      truthy=1\n      break\n    if(truthy==1):\n     break\n    else:\n     \n     if(one not in posb):\n      posb.append(one)\n     qq=0\n     for j in range(len(posb)):\n      if(a[posb[j]]!=current):\n       qq=1\n     if(qq):\n      for j in range(len(posb)):\n       a[posb[j]]=current\n      list1.append(posb)\n   if(truthy):\n    print(-1)\n   else:\n    print(len(list1))\n    for i in range(len(list1)):\n     print(len(list1[i]),end=" ")\n     for j in range(len(list1[i])):\n      print(list1[i][j],end=" ")\n     print("\\n")'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 14083