#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1e9 + 7;
const long long int SIZE = 150007;
const long long int MOD = 1073741824;
void solve() {
  long long int n;
  cin >> n;
  ;
  string s;
  cin >> s;
  char prev = s[n - 1];
  long long int itr1 = 0, itr2 = n - 1;
  bool start = false;
  string s1 = s, zero = "", one = "", ans = "";
  for (long long int i = 0; i <= n - 1; i++) {
    if (s[i] == '1') start = 1;
    if (start == 0) {
      zero += '0';
      itr1++;
    } else {
      break;
    }
  }
  start = 0;
  for (long long int i = n - 1; i >= 0; i--) {
    if (s[i] == '0') start = 1;
    if (start == 0) {
      one += '1';
      itr2--;
    }
  }
  if (itr2 < itr1) {
    cout << zero + ans + one << "\n";
    return;
  }
  if (itr2 != itr1) {
    cout << zero + "0" << one << "\n";
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  cin >> t;
  while (t--) {
    solve();
  }
  cerr << "Time : " << 1000 * (long double)clock() / (long double)CLOCKS_PER_SEC
       << "ms\n";
  ;
}
