#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);
  ;
  int t;
  cin >> t;
  while (t--) {
    int n;
    string x;
    cin >> n >> x;
    int firstone = -1, lastzero = -1;
    for (long long i = 0; i < n; i++) {
      if (x[i] == '1' and firstone == -1)
        firstone = i;
      else if (x[i] == '0')
        lastzero = i;
    }
    if (firstone > lastzero or (firstone == -1 and lastzero != -1))
      cout << x;
    else {
      x.replace(firstone, (lastzero - firstone) + 1, "0");
      cout << x;
    }
    cout << "\n";
  }
}
