#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  int T;
  cin >> T;
  while (T--) {
    long long int n;
    string second;
    cin >> n;
    cin >> second;
    vector<char> v, v1;
    int first = 0;
    int f1 = 0;
    int f2 = 0;
    for (int i = n - 1; i >= 0; i--) {
      if (first == 0 && second[i] == '1') {
        v.emplace_back(second[i]);
      }
      if (first == 0 && second[i] == '0') {
        v.emplace_back(second[i]);
        first = 1;
        f1 = i;
        break;
      }
    }
    for (int i = 0; i < n; i++) {
      if (second[i] == '0' && i < f1) {
        v.emplace_back(second[i]);
      }
      if (second[i] == '1') {
        break;
      }
    }
    reverse(v.begin(), v.end());
    for (int i = 0; i < v.size(); i++) {
      cout << v[i];
    }
    cout << "\n";
  }
  return 0;
}
