#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const int inf = 1e9;
const int N = 201;
bool flag;
void solve() {
  int n, q;
  cin >> n >> q;
  string second;
  cin >> second;
  vector<int> a(n + 1), pref(n + 1), rev(n + 1);
  for (int i = 1; i <= n; i++) {
    int x = second[i - 1] == '-' ? -1 : 1;
    a[i] = x;
  }
  for (int i = 1; i <= n; i++) rev[i] = rev[i - 1] + a[i];
  for (int i = 2; i <= n; i += 2) a[i] = -a[i];
  for (int i = 1; i <= n; i++) pref[i] = pref[i - 1] + a[i];
  while (q--) {
    int l, r;
    cin >> l >> r;
    if (pref[r] - pref[l - 1] == 0)
      cout << 0;
    else {
      if (r - l + 1 & 1) {
        cout << "1\n";
      } else {
        cout << "2\n" << r << ' ';
        r--;
      }
      int tmp = min(pref[r], pref[l - 1]) + abs(pref[l - 1] - pref[r]) / 2;
      int L = l - 1, R = r;
      while (L + 1 < R) {
        int mid = L + R >> 1;
        if ((pref[mid] <= tmp) == (pref[L] <= tmp))
          L = mid;
        else
          R = mid;
      }
      cout << L + 1;
    }
    cout << '\n';
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(12);
  int tt = 1;
  cin >> tt;
  while (tt--) {
    flag = 0;
    solve();
    cout << '\n';
  }
  return 0;
}
