#include <bits/stdc++.h>
using namespace std;
long long fpow(long long x, long long y, long long m) {
  long long temp;
  if (y == 0 || x == 1) return 1;
  temp = fpow(x, y / 2, m);
  if (y % 2 == 0)
    return ((temp) * (temp)) % m;
  else
    return (((x) % m) * ((temp * temp) % m)) % m;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void sieve(long long n) {
  bool prime[5 * 100005];
  memset(prime, true, sizeof(prime));
  long long rootn = (long long)sqrt(n);
  for (long long p = 2; p <= rootn; p++)
    if (prime[p] == true)
      for (long long i = p * p; i <= n; i += p) prime[i] = false;
  prime[1] = 0;
}
long long cnt, sum, mid, mx = -1e17, mn = 1e17, a[2 * 100005];
long long n, m, d, t, i, j, k, l, r, x, y, z;
bool f, f1, f2;
string s;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  for (long long tt = 1; tt <= t; ++tt) {
    cin >> n;
    cin >> s;
    l = s.length();
    for (i = 0; i < l; i++) {
      if (s[i] == '1') {
        break;
      }
      cout << 0;
    }
    cnt = 0;
    j = l - 1;
    while (1) {
      if (s[j] == '0') {
        break;
      }
      cnt++;
      j--;
      if (j < 0) {
        break;
      }
    }
    if (j != i - 1) {
      cout << 0;
    }
    while (cnt--) {
      cout << 1;
    }
    cout << "\n";
  }
}
