#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int mod = 998244353;
const int inf = 1e9 + 5;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    string s;
    cin >> n >> s;
    for (int i = 0; i < n; i++) {
      if (s[i] == '1') break;
      cout << '0';
    }
    for (int i = 0; i < n - 1; i++) {
      if (s[i] == '1' && s[i + 1] == '0') {
        cout << '0';
        break;
      }
    }
    for (int i = n - 1; i >= 0; i--) {
      if (s[i] == '0') break;
      cout << '1';
    }
    cout << '\n';
  }
  return 0;
}
