#include <bits/stdc++.h>
const int inf = 0x3f3f3f3f;
const double eps = 1e-6;
using namespace std;
char s[2000005];
void solve() {
  int n;
  scanf("%d", &n);
  scanf("%s", s);
  int l = 0;
  for (; l < n; l++) {
    if (s[l] == '1') break;
  }
  int r = n - 1;
  for (; r >= 0; r--) {
    if (s[r] == '0') break;
  }
  for (int i = 1; i <= l; i++) printf("0");
  if (l < r) {
    printf("0");
  }
  for (int i = r + 1; i < n; i++) printf("1");
  puts("");
}
int main() {
  int T = 1;
  scanf("%d", &T);
  while (T--) {
    solve();
  }
  return 0;
}
