#include <bits/stdc++.h>
using namespace std;
int t, i;
int main() {
  cin >> t;
  for (i = 0; t > i; i++) {
    int lenght;
    cin >> lenght;
    char s[lenght];
    for (int a = 0; lenght > a; a++) {
      cin >> s[a];
    }
    int firstzero = lenght - 1;
    int firstone = 0;
    while (s[firstzero] == '1') {
      firstzero--;
    }
    while (s[firstone] == '0') {
      firstone++;
    }
    if (i != 0) {
      cout << endl;
    }
    for (int c = 0; lenght > c; c++) {
      if (c < firstone || c >= firstzero) {
        cout << s[c];
      }
    }
  }
  return 0;
}
