思路:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define lson p << 1
#define rson p << 1 | 1
const int maxn = 1e6 + 5, inf = 1e9 + 5, maxm = 4e4 + 5, mod = 1e9 + 7, N = 1e6;
int a[maxn], p[maxn];
int n, m;
string s;
int qpow(int a, int b){
int res = 1;
while(b){
if(b & 1) res = res * a % mod;
a = a * a % mod;
b >>= 1;
}
return res;
}
void solve(){
int res = 0;
cin >> n;
// for(int i = 1; i <= n; i++){
// cin >> a[i];
// }
// cout << res << '\n';
cin >> s;
int t = 0;
int pos = -1;
for(int i = 0; i < n; i++){
if(s[i] == '1'){
t ^= 1;
pos = i;
}
}
if(t || pos == -1){
cout << "No\n";
return;
}
pos = (pos + 1) % n;
int j = (pos + 1) % n;
cout << "Yes\n";
while(j != pos){
cout << pos + 1 << ' ' << j + 1 << '\n';
while(s[j] != '1'){
cout << j + 1 << ' ' << (j + 1) % n + 1 << '\n';
j = (j + 1) % n;
}
j = (j + 1) % n;
}
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
// fac[0] = 1;
// for(int i = 1; i <= N; i++){
// fac[i] = fac[i - 1] * i % mod;
// }
int T = 1;
cin >> T;
while (T--)
{
solve();
}
return 0;
}