#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string s;
    cin >> s;
    vector<pair<char, long long>> p;
    p.push_back({s[0], 1});
    for (long long i = 1; i < n; i++) {
      if (s[i] == p[p.size() - 1].first) {
        p[p.size() - 1].second++;
      } else {
        p.push_back({s[i], 1});
      }
    }
    if (p.size() == 2 && s[0] == '1') {
      cout << "0\n";
      continue;
    }
    if (p.size() <= 2) {
      cout << s;
    } else {
      if (p[0].first == '0') {
        for (long long i = 0; i < p[0].second + 1; i++) {
          cout << 0;
        }
        if (p.size() % 2 == 0) {
          for (long long i = 0; i < p[p.size() - 1].second; i++) {
            cout << 1;
          }
        }
      } else {
        cout << 0;
        if (p.size() % 2 != 0) {
          for (long long i = 0; i < p[p.size() - 1].second; i++) {
            cout << 1;
          }
        }
      }
    }
    cout << '\n';
  }
}
