#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5, mod = 1e9 + 7, INF = 0x3f3f3f3f;
const double eps = 1e-6;
int a[N];
map<int, vector<int>> mp;
int cal(int l, int r) {
  int t = a[l - 1] + a[r];
  return *lower_bound(mp[t].begin(), mp[t].end(), l);
}
void solve() {
  mp.clear();
  int n, m;
  string s;
  scanf("%d%d", &n, &m);
  cin >> s;
  s = ' ' + s;
  for (int i = 1; i <= n; i++) {
    if (i % 2) {
      if (s[i] == '+')
        a[i] = a[i - 1] + 1;
      else
        a[i] = a[i - 1] - 1;
    } else {
      if (s[i] == '+')
        a[i] = a[i - 1] - 1;
      else
        a[i] = a[i - 1] + 1;
    }
    mp[a[i] + a[i - 1]].push_back(i);
  }
  while (m--) {
    int first, second;
    scanf("%d%d", &first, &second);
    int t = abs(a[second] - a[first - 1]);
    int ans = second - first + 1;
    if (!t)
      puts("0");
    else {
      if (ans % 2) {
        puts("1");
        printf("%d\n", cal(first, second));
      } else {
        puts("2");
        printf("%d %d\n", first, cal(first + 1, second));
      }
    }
  }
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
