#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d", &n);
    char a[n + 1];
    scanf("%s", &a);
    char s[n + 2];
    int count = 0, count1 = 0, kt = 0, count2 = 0;
    char s1[n + 1];
    for (int i = n - 1; i >= 1; i--) {
      if (a[n - 1] == '1' && a[i] == '1' && count == 0) {
        s1[count1] = '1';
        count1++;
      }
      if (a[i] == '0' && a[i - 1] == '1' && count2 == 0) {
        kt = 1;
        s1[count1] = '0';
        count1++;
        count2++;
      }
      if (a[i] == '1' && a[i - 1] == '0' && count == 0) {
        count++;
      }
    }
    if (kt == 1) {
      for (int i = 0; i < n; i++) {
        if (a[i] == '0') printf("0");
        if (a[i] == '1') break;
      }
      for (int i = count1 - 1; i >= 0; i--) {
        printf("%c", s1[i]);
      }
    } else {
      for (int i = 0; i < n; i++) {
        printf("%c", a[i]);
      }
    }
    printf("\n");
  }
  return 0;
}
