#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const ll mod = 1000000007;
const ll M = 1000000000000000000ll;
inline ll add(ll a, ll b) { return ((a % mod + b % mod) % mod); }
inline ll sub(ll a, ll b) { return ((a % mod - b % mod + mod) % mod); }
inline ll mult(ll a, ll b) { return (((a % mod) * (b % mod)) % mod); }
inline ll power(ll n, ll x) {
  ll p = 1;
  while (x != 0) {
    if (x % 2 == 0) {
      n = mult(n, n);
      x = x / 2;
    }
    p = mult(p, n);
    x--;
  }
  return p;
}
inline ll recurmult(ll a, ll b) {
  ll r = 0;
  while (b) {
    if (b & 1) r = add(r, a);
    a = mult(2, a);
    b >>= 1;
  }
  return r % mod;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll t;
  cin >> t;
  while (t--) {
    ll n, i, j, k;
    cin >> n;
    string s, ans1 = "", ans2 = "";
    cin >> s;
    for (i = 0; i < n; i++) {
      if (s[i] == '0')
        ans1 += '0';
      else
        break;
    }
    for (j = n - 1; j >= 0; j--) {
      if (s[j] == '1')
        ans2 += '1';
      else
        break;
    }
    if (i <= j)
      cout << ans1 + '0' + ans2 << "\n";
    else
      cout << ans1 + ans2 << "\n";
  }
}
