#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, i, j, k = 0, m = 0, z = 0, nk = 1;
    string s;
    cin >> n;
    cin >> s;
    vector<int> v;
    for (i = 0; i < n; i++) {
      if (i == 0 && s[0] == '0') {
        v.push_back(0);
        z = 0;
      } else if (z == 0 && s[i] == '0') {
        v.push_back(0);
      } else if (s[i] == '1') {
        z = 1;
        k++;
        m = 1;
      } else if (s[i] == '0' && m >= 1) {
        z = 1;
        k = 0;
        if (m == 1 && nk == 1) {
          v.push_back(0);
          nk = 0;
        }
        m++;
      }
    }
    if (k != 0) {
      for (j = 0; j < k; j++) v.push_back(1);
    }
    for (i = 0; i < v.size(); i++) cout << v[i];
    cout << endl;
  }
}
