#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  string ans = "";
  int cnt = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == '1') {
      if (cnt > 0) {
        while (i >= 0 && s[i] == '1') i--;
        cnt = 1;
        i++;
      } else
        ans += '1';
    } else {
      cnt++;
    }
  }
  while (cnt--) ans += '0';
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) solve();
}
