#include <bits/stdc++.h>
using namespace std;
int n;
string s;
bool es[100001];
string ans;
void wk() {
  int i;
  cin >> n;
  cin >> s;
  for (i = 0; i <= n; i++) es[i] = false;
  int fstone = n;
  for (i = 0; i < n; i++)
    if (s[i] == '1') {
      fstone = i;
      break;
    }
  bool zero = false;
  for (i = n - 1; i >= 0; i--) {
    if (s[i] == '0' && zero && fstone < i) es[i] = true;
    if (s[i] == '1' && zero) es[i] = true;
    if (s[i] == '0') zero = true;
  }
  ans = "";
  for (i = 0; i < n; i++)
    if (!es[i]) ans += s[i];
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  int i;
  cin >> t;
  for (i = 1; i <= t; i++) wk();
  return 0;
}
