#include <bits/stdc++.h>
using namespace std;
void solve2() {
  int n;
  string s;
  cin >> n >> s;
  for (int i = (int)s.size() - 1; i >= 0; i--) {
    if (s[i] == '1') {
      while (i + 2 < (int)s.size() && s[i + 2] == '0') {
        s.erase(begin(s) + i + 1);
      }
    }
    if (i + 1 < (int)s.size() && i - 1 >= 0) {
      if ((s[i] == '1' && s[i - 1] == '0' && s[i + 1] == '0') ||
          (s[i] == '1' && s[i - 1] == '1' && s[i + 1] == '0')) {
        s.erase(begin(s) + i);
        i++;
      }
    }
    if (s[i] == '1' && i + 1 < (int)s.size() && s[i + 1] == '0')
      s.erase(begin(s) + i);
  }
  cout << s << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    solve2();
  }
  return 0;
}
