#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T;
  cin >> T;
  while (T--) {
    int n, i = 0;
    string s = "", ans = "";
    cin >> n >> s;
    while (s[i] == '0') {
      ans += '0';
      i++;
    }
    i = n - 1;
    while (s[i] == '1') {
      ans += '1';
      i--;
    }
    for (int i = 0; i < n - 1; i++)
      if (s[i] == '1' && s[i + 1] == '0') {
        ans = '0' + ans;
        break;
      }
    cout << ans << '\n';
    ;
  }
  return 0;
}
