#include <bits/stdc++.h>
using namespace std;
void fileioe() {
  freopen("input.txt", "r", stdin);
  freopen("xyz.txt", "w", stdout);
  freopen("error.txt", "w", stderr);
}
const long long mod = 1000000007;
const long long INF = 1e18;
const long long MAX = 100001;
void solve() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  string str1, str2;
  int flag1 = 0, flag0 = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '1') {
      flag1 = 1;
      for (int j = 0; j < i; j++) {
        if (s[j] == '0') str1 += '0';
      }
      break;
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == '0') {
      flag0 = 1;
      str2 = s.substr(i);
      break;
    }
  }
  if (flag1 == 0 || flag0 == 0) {
    cout << s << endl;
    return;
  }
  string res = str1 + str2;
  if (res.length() > n) {
    cout << res.substr(1) << endl;
    return;
  }
  cout << res << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t;
  t = 1;
  cin >> t;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
