#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n, c = 1;
    cin >> n;
    string s, t1 = "", t2 = "";
    cin >> s;
    vector<int> v;
    for (int i = 0; i < n; i++) {
      if (s[i] == '0')
        t2 += s[i];
      else
        break;
    }
    for (int i = n - 1; i >= 0; i--) {
      if (s[i] == '1') {
        t1 += s[i];
      } else
        break;
    }
    if (n != (t1.length() + t2.length())) t2 += '0';
    s = t2 + t1;
    cout << s << endl;
  }
  return 0;
}
