#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, i, j = n;
    scanf("%d", &n);
    string s;
    cin >> s;
    bool zero = true, one = true;
    for (i = 0; i < n; i++) {
      if (s[i] == '0') {
        j = i;
        zero = false;
      }
      if (s[i] == '1') {
        one = false;
      }
    }
    if (zero || one) {
      cout << s << endl;
      continue;
    }
    for (i = n - 1; i >= 0; i--) {
      if (s[i] == '0') {
        j = i;
        zero = false;
        break;
      }
      if (s[i] == '1') {
        one = false;
      }
    }
    int k = n + 1;
    for (i = j - 1; i >= 0; i--) {
      if (s[i] == '1') {
        k = min(k, i);
      }
    }
    if (k < j) {
      s.erase(k, j - k);
    }
    cout << s << endl;
  }
  return 0;
}
