#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define PG_Mazen ios_base::sync_with_stdio( 0 ), cin.tie( 0 ), cout.tie( 0 );
#define el '\n'
#define sp ' '
#define all(v) v.begin(), v.end()
#define r_all(v) (v).rbegin(), (v).rend()
#define SZ(v) (v).size()
#define pb(n) push_back(n)
#define eb(n, m) emplace_back(n, m)
#define YES cout << "YES\n"
#define NO cout << "NO\n"
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll,ll>
#define F first
#define S second
#define loop int t; cin >> t; for(int i=1;i<=t;++i)
#define f0(i, st, n) for(int i=st;i<n;++i)
#define f1(i, st, n) for(int i=st;i<=n;++i)
#define fe(it, n) for(auto &it : n)
#define mms(arr, val) memset(arr, val, sizeof arr)
#define mmv(vec, val) memset(vec[0], val, sizeof(vec) * SZ(vec))
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
const int N = 2e5 + 5, MOD = 998244353, oo = 0x3f3f3f3f;
const ll ooo = 0x3f3f3f3f3f3f3f3f;
void testCase() {
int n;
string s;
cin >> n >> s;
reverse(s.begin(), s.end());
vector<int> ans;
ans.push_back(0);
queue<int> q;
for(int i = 0; i < n; ++i) {
if (s[i] == '0')
q.push(i);
}
for (int i = 0; i < n; ++i) {
if (q.empty()) {
ans.push_back(-1);
continue;
}
int head = q.front(), lst = ans.back();
ans.push_back(head - i + lst);
q.pop();
}
for (int i = 1; i < ans.size(); ++i)
cout << ans[i] << ' ';
cout << '\n';
}
int main() {
PG_Mazen
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
loop testCase();
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNpbmNsdWRlIDxleHQvcGJfZHMvYXNzb2NfY29udGFpbmVyLmhwcD4KI2luY2x1ZGUgPGV4dC9wYl9kcy90cmVlX3BvbGljeS5ocHA+Cgp1c2luZyBu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mVlPGludCwgbnVsbF90eXBlLCBsZXNzPGludD4sIHJiX3RyZWVfdGFnLCB0cmVlX29yZGVyX3N0YXRpc3RpY3Nfbm9kZV91cGRhdGU+Cgpjb25zdCBpbnQgTiA9IDJlNSArIDUsIE1PRCA9IDk5ODI0NDM1Mywgb28gPSAweDNmM2YzZjNmOwpjb25zdCBsbCBvb28gPSAweDNmM2YzZjNmM2YzZjNmM2Y7Cgp2b2lkIHRlc3RDYXNlKCkgewogICAgaW50IG47CiAgICBzdHJpbmcgczsKICAgIGNpbiA+PiBuID4+IHM7CiAgICByZXZlcnNlKHMuYmVnaW4oKSwgcy5lbmQoKSk7CiAgICB2ZWN0b3I8aW50PiBhbnM7CiAgICBhbnMucHVzaF9iYWNrKDApOwogICAgcXVldWU8aW50PiBxOwogICAgZm9yKGludCBpID0gMDsgaSA8IG47ICsraSkgewogICAgICAgIGlmIChzW2ldID09ICcwJykKICAgICAgICAgICAgcS5wdXNoKGkpOwogICAgfQogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyArK2kpIHsKICAgICAgICBpZiAocS5lbXB0eSgpKSB7CiAgICAgICAgICAgIGFucy5wdXNoX2JhY2soLTEpOwogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICB9CiAgICAgICAgaW50IGhlYWQgPSBxLmZyb250KCksIGxzdCA9IGFucy5iYWNrKCk7CiAgICAgICAgYW5zLnB1c2hfYmFjayhoZWFkIC0gaSArIGxzdCk7CiAgICAgICAgcS5wb3AoKTsKICAgIH0KICAgIGZvciAoaW50IGkgPSAxOyBpIDwgYW5zLnNpemUoKTsgKytpKQogICAgICAgIGNvdXQgPDwgYW5zW2ldIDw8ICcgJzsKICAgIGNvdXQgPDwgJ1xuJzsKfQoKaW50IG1haW4oKSB7CiAgICBQR19NYXplbgogICAgLy9mcmVvcGVuKCJpbnB1dC50eHQiLCAiciIsIHN0ZGluKTsKICAgIC8vZnJlb3Blbigib3V0cHV0LnR4dCIsICJ3Iiwgc3Rkb3V0KT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