#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
unsigned seed = chrono::system_clock::now().time_since_epoch().count();
mt19937 eng(seed);
long long random2() { return (1ll << 31ll) * eng() + eng(); }
long long n, m, k, q, T;
const long long big = 1000000007;
const long long big2 = 1000000009;
const long long mod = 998244353;
const int MAXN = 1000001;
int bs(int L, vector<int>& X) {
  int l = 0;
  int r = (int)(X).size() - 1;
  if (X.back() < L) return -1;
  if (X[0] >= L) return X[0];
  while (l < r - 1) {
    int mid = (l + r) / 2;
    if (X[mid] >= L) {
      r = mid;
    } else {
      l = mid;
    }
  }
  return X[r];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long a, b, c, d, e;
  cin >> T;
  for (int c1 = 0; c1 < (T); ++c1) {
    cin >> n >> q;
    vector<int> A, pref;
    pref.push_back(0);
    string s;
    cin >> s;
    vector<vector<int> > C;
    map<int, int> M;
    for (int c1 = 0; c1 < (n); ++c1) {
      a = (s[c1] == '+');
      a ^= (c1 % 2);
      if (a == 0) {
        A.push_back(-1);
      } else {
        A.push_back(1);
      }
      pref.push_back(pref.back() + A.back());
      int h = 2 * pref[c1] + A.back();
      if (M.find(h) == M.end()) {
        M[h] = (int)(C).size();
        vector<int> tmp;
        C.push_back(tmp);
      }
      C[M[h]].push_back(c1);
    }
    for (int c1 = 0; c1 < (q); ++c1) {
      cin >> a >> b;
      a--;
      b--;
      int sum = abs(pref[b + 1] - pref[a]);
      if (sum == 0) {
        cout << "0\n";
      } else {
        vector<int> res;
        if ((b - a + 1) % 2 == 0) {
          res.push_back(a);
          a++;
        }
        int x = -1;
        int look = (pref[b + 1] + pref[a] - 1) / 2;
        look = 2 * look + 1;
        if (M.find(look) != M.end()) x = bs(a, C[M[look]]);
        if (x == -1) {
          look = (pref[b + 1] + pref[a] + 1) / 2;
          look = 2 * look - 1;
          x = bs(a, C[M[look]]);
        }
        res.push_back(x);
        cout << (int)(res).size() << "\n";
        for (auto& yy : res) {
          cout << yy + 1 << " ";
        }
        cout << "\n";
      }
    }
  }
  return 0;
}
