#include <bits/stdc++.h>
using namespace std;
const int C = (int)6e5;
int sum[300005];
vector<int> v[2 * C + 1];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    memset(sum, 0, sizeof(sum));
    int n, q, t;
    scanf("%d%d ", &n, &q);
    for (int i = C - 2 * n; i <= C + 2 * n; i++) v[i].clear();
    for (int i = 1; i <= n; i++) {
      char temp;
      t = (i % 2 == 1 ? 1 : -1);
      scanf("%c", &temp);
      sum[i] = sum[i - 1] + t * (temp == '+' ? 1 : -1);
      v[sum[i] + sum[i - 1] + C].push_back(i);
    }
    while (q--) {
      int l, r;
      scanf("%d%d", &l, &r);
      if (sum[r] - sum[l - 1] == 0) {
        printf("0\n");
        continue;
      }
      if ((r - l + 1) % 2 == 1)
        printf("1\n");
      else {
        printf("2\n%d ", l);
        l++;
      }
      int x = sum[l - 1] + sum[r] + C;
      int ans = lower_bound(v[x].begin(), v[x].end(), l) - v[x].begin();
      printf("%d\n", v[x][ans]);
    }
  }
  return 0;
}
