#include <bits/stdc++.h>   using namespace std;   const int oo = 3e5 + 7;   unordered_map<int, vector<int>> values[2];   int t, n, q, a[oo], p[oo];   vector<int> ans;   int psum(int l, int r) { return p[r] - (l ? p[l - 1] : 0); }   int first(vector<int>& list, int val) {     int l = 0, r = list.size();     while (l < r) {       int s = (l + r) / 2;       if (list[s] >= val)         r = s;       else         l = s + 1;     }     if (l == list.size()) return n * 2;     return list[l];   }   void problem(int l, int r) {     int sum = psum(l, r);     if (sum == 0) return;     if (sum % 2 == 0) {       ans.push_back(r);       problem(l, r - 1);       return;     }     int pl = p[l] - a[l];     int vals[2] = {pl + (sum + 1) / 2 - 1, pl + (sum - 1) / 2 + 1};     for (int i = 0; i < 2; i++) {       int pans = first(values[i][vals[i]], l);       if (pans <= r) {         ans.push_back(pans);         return;       }     }     throw 69;   }   void solve() {     cin >> n >> q;     string ss;     cin >> ss;     for (int i = 0; i < n; i++)       a[i] = (ss[i] ==  +  ? 1 : -1) * (i % 2 == 0 ? -1 : 1);     p[0] = a[0];     for (int i = 1; i < n; i++) p[i] = p[i - 1] + a[i];     for (int i = 0; i < n; i++) values[(a[i] + 1) / 2][p[i]].push_back(i);     while (q--) {       int l, r;       cin >> l >> r;       l--, r--;       problem(l, r);       cout << ans.size() << endl;       for (int e : ans) cout << e + 1 <<    ;       cout << endl;       ans.clear();     }     values[0].clear();     values[1].clear();   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cin >> t;     while (t--) solve();   }   