#include <bits/stdc++.h>
using namespace std;
const int N = 2000005;
int n, q;
int sum[N];
vector<int> v[N];
char s[N];
int get(int l, int r) {
  int now = sum[l - 1] + sum[r] + 2 * n;
  int pos =
      (int)(lower_bound(v[now].begin(), v[now].end(), l) - v[now].begin());
  return v[now][pos];
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    memset(sum, 0, sizeof sum);
    scanf("%d%d%s", &n, &q, s + 1);
    for (int i = 1; i <= n; i++)
      sum[i] = sum[i - 1] + (s[i] == '+' ? 1 : -1) * (int)pow(-1, i - 1);
    for (int i = 1; i <= n; i++) v[sum[i] + sum[i - 1] + 2 * n].push_back(i);
    while (q--) {
      int l, r;
      scanf("%d%d", &l, &r);
      int now = abs(sum[r] - sum[l - 1]);
      if (now == 0)
        printf("0\n");
      else if ((r - l + 1) % 2)
        printf("1\n%d\n", get(l, r));
      else
        printf("2\n%d %d\n", get(l, r - 1), r);
    }
    for (int i = 1; i <= n; i++) v[sum[i] + sum[i - 1] + 2 * n].clear();
  }
}
