#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast", "inline", "unroll-loops", "omit-frame-pointer")
const long long oo = 715827882;
const int MAX_N = 3e5 + 5;
inline std::chrono::high_resolution_clock::time_point getTime() {
  return std::chrono::high_resolution_clock::now();
}
inline long long getElapsedNano(
    std::chrono::high_resolution_clock::time_point& start) {
  return std::chrono::duration_cast<std::chrono::duration<int64_t, std::nano>>(
             getTime() - start)
      .count();
}
stringstream out;
int arr[MAX_N];
struct Solution {
  void solve() {
    int N, Q;
    cin >> N >> Q;
    string str;
    cin >> str;
    for (int i = 0; i < N; i++) {
      arr[i + 1] = arr[i];
      int val = str[i] == '+' ? 1 : -1;
      if (i % 2 == 1) val *= -1;
      arr[i + 1] += val;
    }
    for (int i = 0; i < Q; i++) {
      int a, b;
      cin >> a >> b;
      int len = b - a + 1;
      if (len % 2 == 0) {
        int res = (arr[b] - arr[a - 1]) != 0;
        res *= 2;
        out << res << '\n';
        if (res == 0) {
          continue;
        }
        out << a << ' ';
        a++;
      } else {
        out << 1 << '\n';
      }
      int low = a;
      int high = b;
      int num = arr[b] - arr[a - 1];
      num /= abs(num);
      while (low <= high) {
        int mid = (low + high) / 2;
        int val = (arr[mid - 1] - arr[a - 1]) - (arr[b] - arr[mid]);
        if (val == 0) {
          out << mid << '\n';
          break;
        }
        val /= abs(val);
        if (val == num) {
          high = mid - 1;
        } else {
          low = mid + 1;
        }
      }
    }
  }
};
int main() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  Solution solution;
  int tc = 1;
  cin >> tc;
  for (int t = 1; t <= tc; t++) {
    solution.solve();
  }
  cout << out.str();
  cout.flush();
}
