#include <bits/stdc++.h>
using namespace std;
long long T, a, q, x, y, b, pre[300005], res, mi0, mi0ans;
const int mod = 300005;
char c;
vector<int> v[5][600500];
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d%d", &a, &q);
    for (int i = 300005 - a; i <= 300005 + a; i++)
      v[0][i].clear(), v[1][i].clear();
    for (int i = 1; i <= a; i++) {
      cin >> c;
      if (c == '+')
        b = 1;
      else
        b = -1;
      if (i % 2 == 1)
        pre[i] = pre[i - 1] + b;
      else
        pre[i] = pre[i - 1] - b;
      if (pre[i] == pre[i - 1] + 1)
        v[1][pre[i - 1] + 300005].push_back(i);
      else
        v[0][pre[i - 1] + 300005].push_back(i);
    }
    for (int i = 1; i <= q; i++) {
      scanf("%d%d", &x, &y);
      res = pre[y] - pre[x - 1];
      if (res == 0) {
        puts("0");
        continue;
      } else if (abs(res) % 2 == 0)
        puts("2");
      else
        puts("1");
      if (abs(res) % 2 == 0) printf("%d ", y), y--;
      res = pre[y] - pre[x - 1];
      mi0 = (res + 1) / 2;
      mi0 += pre[x - 1];
      mi0 += mod;
      mi0ans = lower_bound(v[0][mi0].begin(), v[0][mi0].end(), x) -
               v[0][mi0].begin();
      if (v[0][mi0].size() > 0) {
        if (mi0ans < v[0][mi0].size()) {
          if (v[0][mi0][mi0ans] >= x && v[0][mi0][mi0ans] <= y) {
            printf("%d\n", v[0][mi0][mi0ans]);
            continue;
          }
        }
      }
      mi0 = (res - 1) / 2;
      mi0 += pre[x - 1];
      mi0 += mod;
      mi0ans = lower_bound(v[1][mi0].begin(), v[1][mi0].end(), x) -
               v[1][mi0].begin();
      if (v[1][mi0].size() > 0) {
        if (mi0ans < v[1][mi0].size()) {
          if (v[1][mi0][mi0ans] >= x && v[1][mi0][mi0ans] <= y) {
            printf("%d\n", v[1][mi0][mi0ans]);
            continue;
          }
        }
      }
    }
  }
  return 0;
}
